Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Tunable Kernel Parameters: HP-UX Release 11i Version 1.6 > Chapter 5 Interprocess Communication (IPC) Subsystem

Overview of Shared Memory Operation

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

See “Shared Memory Parameter Summary” for the list of parameters.

Shared Memory

Shared memory is reserved memory space for storing data structures and data being shared between or among cooperating processes. Sharing a common memory space eliminates the need for copying or moving data to a separate location before it can be used by other processes, reducing processor time and overhead as well as memory consumption.

Shared Memory Access and Use

Shared memory management is similar in many respects to messages and semaphores. A process requests a shared memory segment allocation by means of the shmget() system call, specifying the segment size in one of the function parameters (see shmget(2)). One or more processes can then attach to the allocated segment by using the shmat() system call and detach when finished with the shmdt() system call (see shmop(2)). shmctl() is used to obtain information about the segment, and to remove the segment when it is no longer needed (see shmctl(2)).

Semaphores can be used to prevent shared memory read/write access collisions, but the more common method is for one process to populate (write to) a given shared memory segment and other processes read from the segment (write once, read many). In such arrangements, when a subsequent write operation is to be performed, the writing process allocates a new segment, and cooperating processes attach to that new segment when ready to use it.

Shared memory is allocated in swappable shared memory space. Data structures for managing shared memory are located in the kernel.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2000-2003 Hewlett-Packard Development Company, L.P.