Introduction to the use of memory-mapped files under Linux

Source: Internet
Author: User

Brief introduction:

Memory-mapped files are somewhat similar to virtual memory, where a memory-mapped file preserves an area of an address space and submits the physical memory to this zone, except that the physical memory of the memory-file mapping comes from a file that already exists on disk, not the system's page file. And before you can manipulate the file, you must first map the file as if you were loading the entire file from disk into memory. As you can see, using a memory-mapped file to process files stored on disk eliminates the need to perform I/O operations on files (virtual memory needs to be added from disk to physical memory), which means that files are no longer requested and allocated for caching when they are processed . All file caching operations are managed directly by the system, and the memory-mapped file can play a significant role in processing large data volumes by canceling the steps such as loading the file data into memory, data from memory to file writeback, and freeing memory blocks . In addition, the actual project in the system often need to share data between multiple processes, if the amount of data is small, the processing method is flexible, if the shared data capacity is huge, then need to use the memory map file. In fact, a memory-mapped file is the most efficient way to resolve data sharing across multiple processes on-premises.

On the internet to find some code, their own processing after the Linux compiled through, you can run to achieve the corresponding functions.

Transferred from: http://blog.csdn.net/yasaken/article/details/7229076

Introduction to the usage of memory-mapped files under Linux (RPM)

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.