HP-UX Reference (11i v2 03/08) - 1M System Administration Commands N-Z (vol 4)

s
setmemwindow(1M) setmemwindow(1M)
-j Join an existing window with id WinId . The specified process attaches to an existing
memory window. If no entry exists the call fails.
-n If program is exec’ed, the default behavior is to
waitpid (see the wait(2) manual page) for
the process to terminate. Specifying
-n causes setmemwindow
to exit after fork’ing the
child (that will exec program).
-f The default behavior for setmemwindow is to exit without executing the user specified pro-
gram if the memory window cannot be set. The failure to set the memory window may be
caused by the lack of enough memory windows in the system, the memory windows feature
is not implemented, a memory window with WinId could not be found in the attempt to join
a memory window, or a memory window with the WinId was found in the attempt to create a
memory window. The
-f option instructs setmemwindow
to exec program regardless if
the desired memory window was set or not. Obviously, using this option there is no guaran-
tee program has been attached to the desired memory window and it is unclear in what
memory window it is running. Using this option is strongly discouraged.
-b Create a memory window where both memory window quadrants use the same space id.
For SHMEM_MAGIC executables this generates two quadrants with the same space id.
Applications can use this to generate the appearance of larger contiguous shared memory
ranges with a maximum of 2 gigabytes. For example, an application that generates a 1
gigabyte shared memory segment has that segment placed into the 2nd quadrant by default.
If the application creates another 1 gigabyte segment that segment is placed in the 3rd qua-
drant. Both segments are contiguous virtually, allowing the application to treat the virtual
range as if it were a contiguous 2 gigabyte segment.
This option only benefits
SHMEM_MAGIC executables. They are the only type of executable
format able to place shared objects in the 2nd quadrant.
-o Send the pid of the exec’ed program to the stdout. The message sent out is:
"setmemwindow:pid=dddd\n", where dddd is the decimal value of the pid.
Application Usage
Memory Windows helps alleviate the 1.75 gigabytes limitation on system wide shared memory for 32-
bit applications by allowing cooperating applications to configure their own 1 gigabyte window of shared
resources.
The definition of a memory window is only available for 32-bit processes.
Note that memory windows allows the creation of more than 1.75 gigabytes of total system wide shared
memory, but it does not extend how much shared memory a single process can create.
SHARED_MAGIC
executables are still limited to 1.75 gigabytes.
HP-UX ships memory windows disabled. To enable memory windows, the kernel tunable parameter,
max_mem_window, must be set to the desired number.
max_mem_window represents the number of
memory windows beyond the global default window. Setting
max_mem_window
to 2, for example, would
produce a total of three memory windows, the default global window plus two user defined windows. Set-
ting
max_mem_window to 0 leaves only the default or global memory window.
There are two new commands and one file introduced by memory windows:
setmemwindow, get-
memwindow, and /etc/services.window file.
The
/etc/services.window file maps a memory window application to a particular window id.
Using this central file allows applications to share memory windows, by using the same window id, as
well as avoid unintentional memory window collisions. See services.window(4) for more information.
The
getmemwindow command is used to extract the window id of a user process from the
/etc/services.window file. The setmemwindow command starts a particular process in a memory
window. A common usage of these commands is to extract a memory window id with getmemwindow,
which is then passed to setmemwindow to start a process with the given window id.
Processes must be in the same window to share data. Processes wanting to share global data, such as
shared memory or
MAP_SHARED memory mapped files, must make sure all processes are in the same
memory window. If processes in different memory windows wish to share data reliably, the creator of the
data must take steps to guarantee the data is placed in a location accessible to all processes.
For more detailed information on memory windows, refer to the 11.0 Memory Window White Paper.
Section 1M750 Hewlett-Packard Company 2 HP-UX 11i Version 2: August 2003