Table of Contents



  • Used to ensure that multiple instances of a program, which may be running concurrently on one system, don't access something at the same time.
  • Before a program accesses a resource:
    1. Checks for the presence of a lock file
    2. If it exists $\rightarrow$ error out or wait until it goes away
    3. If it doesn't exists $\rightarrow$ creates the file and thus locking the resource
  • Works because the filesystem under all UNIX-like OSes forces serialization, i.e. only one change to the filesystem actually happens at any given time.