Linux
Files
lock
- 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:
- Checks for the presence of a
lock
file
- If it exists error out or wait until it goes away
- If it doesn't exists 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.