Search code examples
posixshared-memorymemory-mapped-files

Posix shared memory vs mapped files


Having learnt a bit about the subject, can anyone tell, what is the real difference between POSIX shared memory (shm_open) and POSIX mapped files (mmap)?

Both seems to use the /dev/tmpfs subsystem, rather then older IPC mechanism.

So is there any advantage of using mmap file over shared memory?

Thanks.


Solution

  • The distinction is not always clear. Shared memory can be implemented via memory mapped files. An excellent write on this can be found here (as applied to C/C++ programming).