Several IPC mechanisms are available for POSIX systems, including shared memory and message passing. Here, we explore the POSIX API for shared memory
POSIX shared memory is organized using memory-mapped files, which associate the region of shared memory with a file. A process must first create
message next consumed;
while (true) {
receive(next consumed);
/* consume the item in next consumed */
}
a shared-memory object using the shm open() system call, as follows:
shm fd = shm open(name, O CREAT | O RDRW, 0666);