What happens to the Linux system reading the disk file process.

Source: Internet
Author: User

Read procedure: Disk data---kernel state buffers (kernel-state data may be written back to disk)--user-state buffers (user-state data may be swapped to swap or write back to kernel-state buffers)

a a user-state process would have an array of file descriptors, each time the open file adds an element to the array and creates a file object where the most important field in the file object is the pointer to the callback function, which is how the file is manipulated.

When an open () call is issued, the index node is found through the file name, and then the Open function establishes the file object, where the method of manipulating the file in the file object is basically based on the method defined by the file system. However, a file can be open by multiple processes, so there will be multiple file objects, but there is only one file in the kernel state of the disk cache, so there will be multiple process operations with the same disk cache, resulting in multiple inter-process cache inconsistency phenomenon.

Like what:

When reading from disk to the cache, due to the existence of a pre-read mechanism, Process 1 may be pre-read to the page they do not need to read into the cache, and process 2 exactly need this page, process 2 in the disk cache found this page, but this page process 1 is not process Io, that is, the page does not have the file content , when Process 2 detects that the page needs to be re-io, for some reason, for example, system memory is scarce, process 1 will return the dirty pages to memory, so this page is removed from the cache, so process 2 must also release the page box, reapply a page box, and lock the page, start IO. When the IO is finished, the page contents can be copied to the user buffer, but there is still a problem, because there may be a process 3 to open the file in writing, and the file is deleted, causing the page content to be erased from the disk, so also need to process 2 copy data before checking the index of the page is not in the file scope, If not, release the page.

What happens to the Linux system reading the disk file process.

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.