HP Fortran Programmer's Guide (March 2010)
Controlling data storage
Sharing data among programs
Chapter 3118
Run the first program in any process by doing the following:
$ go_to_sleep
In another process, use the following command line to confirm that a shared memory segment
has been created for the program (the last in the list is the newly created one):
$ ipcs -m
IPC status from /dev/kmem as of Fri Mar 21 15:55:29 1997
T ID KEY MODE OWNER GROUP
Shared Memory:
m 0 0x4119c72b --rw-rw-rw- root root
m 1 0x4e180002 --rw-rw-rw- root root
m 2 0x41187bf4 --rw-rw-rw- root root
m 3 0x00000000 --rw------- root sys
m 7004 0x43186ea0 --rw-rw-rw- daemon daemon
m 6005 0x73636231 --rw-rw-rw- ed lang
Now run the second program in the second process:
$ wake_up
At this point, the program executing in the first process outputs the following and completes
execution:
I'm up!
The following command line confirms that the shared memory segment was released:
$ ipcs -m
IPC status from /dev/kmem as of Fri Mar 21 15:55:29 1997
T ID KEY MODE OWNER GROUP
Shared Memory:
m 0 0x4119c72b --rw-rw-rw- root root
m 1 0x4e180002 --rw-rw-rw- root root
m 2 0x41187bf4 --rw-rw-rw- root root
m 3 0x00000000 --rw------- root sys
m 7004 0x43186ea0 --rw-rw-rw- daemon daemon
For information about sharing data between Fortran program units and C functions within
the same program, see “Sharing data” on page 200. The HP Fortran Programmer's Reference
provides detailed information about the COMMON statement and about the
$HP$ SHARED_COMMON directive. Refer to the shmop(2) man page for information about HP-UX
shared memory operations.