Concept:
• Inter-Process Communication (IPC) refers to the mechanisms provided by an operating system to allow processes to manage shared data.
• System V IPC in UNIX provides three main mechanisms: Message Queues, Semaphores, and Shared Memory.
Step 1: Identify the function of each provided system call
• pipe(): Creates a unidirectional data channel that can be used for interprocess communication. It does not involve "shared memory" in the architectural sense.
• msgget(): Used to get a message queue identifier. This belongs to the Message Queue IPC mechanism.
• semctl(): Provides semaphore control operations (like initialization or deletion). This belongs to the Semaphore IPC mechanism.
• shmget(): Stands for "shared memory get". It is used to allocate a System V shared memory segment.
Step 2: Explain the Shared Memory workflow in UNIX
To use shared memory, a process typically follows these steps:
• shmget(): Create the segment and get a unique ID.
• shmat(): Attach the memory segment to the process's address space.
• shmdt(): Detach the segment when finished.
• shmctl(): Delete or modify the segment.
Step 3: Conclusion
Among the options, shmget() is the primary system call associated with establishing shared memory IPC.