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

s
setmemwindow(1M) setmemwindow(1M)
-c Create a window with id WinId and attach the specified process to it. If WinId already exists
the call fails.
-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.
The request requires a new memory window be initialized and the system was not able to
allocate the memory to do so.
A memory window with WinId could not be found in the attempt to join a memory window.
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 guarantee program has been
attached to the desired memory window and it is unclear in what memory window it is run-
ning. 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. Applica-
tions 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 quadrant. Both seg-
ments 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
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 335