Shared memory is still very useful, whether it is to solve the IPC problem, or file Buffer problem, it is amazing.
In the following works, even if you have no knowledge or knowledge about the shared memory, you can easily implement shared memory after reading it.
Inter-process communication in Linux (5): Shared Memory (on)
Inter-process communication in Linux (5): Shared Memory (2)
Dialog Unix: Communication Between processes through the shared memory
Shared Memory Introduction(Shared memory introduction is also available on this site)
After reading this article, I found that the previous two great Zheng Xia's masterpiece is basically the same as the last e article, which can be used as a reference and understood by comparison :)
Yesterday, with reference to the implementation of shared memory and semaphore mutex Log Module, successfully passed, details see http://www.cnblogs.com/inteliot/archive/2012/04/21/2461051.html...
We recommend that you use semaphore for inter-process synchronization, which is simple with low overhead. For details, see the first example in shared memory introduction.
The two most common MMAP modes are:
1) file ing: Use MMAP to map files to the memory to reduce direct operations on the hard disk and improve access efficiency. After a process is launched or encounters an exception, it will be flushed to disk by the system.
2) Anonymous ing: memory blocks are directly generated by the system, mainly used for IPC. They are not instantiated to the local hard disk and will not be automatically destroyed until the system is launched.
The above two examples are detailed in shared memory introduction...