Linux write-time copy technology (Copy-on-write)

Source: Internet
Author: User

1. The traditional fork () function
Create a child process, child process and parent process share body segment, copy data segment, heap, stack to child process
As follows:

2.Linux fork () function-copy-on-write (Copy-on-write)
Create a child process, the kernel only creates virtual space for the child process, does not allocate physical memory, and the parent process shares the physical space,
The child process is allocated a physical space when the behavior of the corresponding segment is changed in the parent process.
As follows:

3.vfork () function
Create a child process that shares everything in the parent process.
As follows:

4. The difference between traditional fork and Copy-on-write

The traditional fork function simply replicates all the resources to a new process, which is inefficient.
When a copy is written, the data is copied, and no data is written, the cost of the fork () is actually simply copying the parent process's page table and creating a unique process descriptor for the child process. Before data is written, the data page to be changed is copied to the child process.

Linux write-time copy technology (Copy-on-write)

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.