A brief introduction of shared memory and MMAP functions for Linux network programming

Source: Internet
Author: User
Tags printf

Overview of Shared memory

The shared memory area is the fastest form of IPC, where data delivery is no longer related to the kernel, in other words, processes no longer pass data to each other by executing system calls into the kernel.

That is, each process address space has a mapped area of shared memory, when this area is mapped to the same real physical address space, it is possible to exchange data through this area, such as shared libraries are implemented, and many processes use the same function as printf, perhaps in the real physical address space There is a printf.o, and then all the processes are mapped to this one and PRINTF.O is shared.

To pass data using pipelines or message queues:

To pass data with shared memory:

Even with shared memory delivery data, it reduces the number of times to enter the kernel and improves efficiency, compared with message queues and pipelines.

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.