This chapter describes System V shared memory. Shared memory allows two or more processes to share the same region (usually referred to as a segment) of physical memory. Since a shared memory segment becomes part of a process's user-space memory, no kernel intervention is required for IPC. All that is required is that one process copies data into the shared memory; that data is immediately available to all other processes sharing the same segment. This provides fast IPC by comparison with techniques such as pipes or message queues, where the sending process copies data from a buffer in user space into kernel memory and the receiving process copies in the reverse direction. (Each process also incurs the overhead of a system call to perform the copy operation.)
On the other hand, the fact that IPC using shared memory is not mediated by the kernel means that, typically, some method of synchronization is required so that processes don’t simultaneously access the shared memory (e.g., two processes performing simultaneous updates, or one process fetching data from the shared memory while another process is in the middle of updating it). System V semaphores are a natural method for synchronizing access to System V shared memory segments
48 System V Shared Memory
48.1 Overview
48.2 Creating or Opening a Shared Memory Segment: shmget()
48.3 Using Shared Memory: shmat() and shmdt()
48.4 Example: Transferring Data Via Shared Memory
48.5 Location of Shared Memory Segments in Virtual Memory
48.6 Storing Pointers in Shared Memory
48.7 Shared Memory Control Operations: shmctl()
48.8 Shared Memory Associated Data Structure
48.9 Shared Memory Limits
48.10 Summary
48.11 Exercises
2009-10-16
Subscribe to:
Post Comments (Atom)
hi where can i get the links to the topics given above and for system V semaphores. Links are not available. Please provide the links if available.
ReplyDelete