O'Reilly logo

Mastering Embedded Linux Programming - Second Edition by Chris Simmonds

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required