3.5. Shared memory segments allocation order

This section explains how shared memory segments are allocated in the process address space. To demonstrate the allocation order, we have prepared the program shown in Example 3-19 on page 151. To compile this program, type the following command:

$ cc -DCALL_SHMDT grabshm.c

If -DCALL_SHMDT is not specified, then the shmdt() and shmctl() routines will not be called in the program; it then leaves shared memory segments after the execution. If the program is executed by the ausres01 user, it then leaves the shared memory segments highlighted in Example 3-18.

Example 3-18. ipcs -m
 $ ipcs -m IPC status from /dev/mem as of Sun Feb 9 18:21:48 CST 2003 T ID KEY MODE OWNER GROUP Shared Memory: m 0 0xe4663d62 ...

Get Developing and Porting C and C++ Applications on AIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.