Posix shared memory vs mapped files

memory-mapped-filesposixshared-memory

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.

Best Answer

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

Related Topic