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.