Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

55. File Locking > Mandatory Locking

Mandatory Locking

The kinds of locks we have described so far are advisory. This means that a process is free to ignore the use of fcntl() (or flock()) and simply perform I/O on the file. The kernel doesn’t prevent this. When using advisory locking, it is up to the application designer to:

  • set appropriate ownership (or group ownership) and permissions for the file, so as to prevent noncooperating process from performing file I/O; and

  • ensure that the processes composing the application cooperate by obtaining the appropriate lock on the file before performing I/O.

Linux, like many other UNIX implementations, also allows fcntl() record locks to be mandatory. This means that every file I/O operation is checked to see whether it is compatible with any locks held by other processes on the region of the file on which I/O is being performed.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint