Linux File lock

Source: Internet
Author: User
Linux File lock

Linux File locks are divided into two types:

One is advasory lock, which can only ensure the mutual exclusion of the same file lock in the process. However, multiple processes can simultaneously Add a mutually exclusive lock to a file, therefore, this lock is applied to the file structure. One is the mandatory lock, which ensures that multiple processes cannot add mutex locks to the same file, therefore, this lock is applied to the inode structure.

When mandatroy lock is added, if the existing process adds mutex lock a to the file, the file_lock B structure created by the process will be added to the waiting list of A. At this time, a is called blocker, B is called waiter. Because the resources (locks) required by the process cannot be met, the process is either blocked, and the descriptor of the process is added to the waiting list of B; or an error is returned directly when a system call is performed. (Depends on the flag value during the call)

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.