Introduction to Linux shared memory

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.