POSIX shared memory

To share memory between processes, you first have to create a new area of memory and then map it to the address space of each process that wants access to it, as shown in the following diagram:

The naming of POSIX shared memory segments follows the pattern we encountered with message queues. The segments are identified by names that begin with a / character and have exactly one such character. The shm_open(3) function takes the name and returns a file descriptor for it. If it does not exist already and the O_CREAT flag is set, then a new segment is created. Initially, it has a size of zero. You can use the (misleadingly ...

Get Mastering Embedded Linux Programming - Second Edition 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.