in reply to Re^4: 'flock' with multiple users
in thread 'flock' with multiple users
flock is a rather general-purpose solution for advisory locks on files. The locking technique can be used for many purposes, but the locks are advisory, and if you use a file lock to signal that a database is in use, that raises the potential for someone using that database to not be aware of an external file that should be checked first. The lock is kind of far away from the resource it is protecting.
By using a database's built-in locks you gain efficiency, and proximity (making it easier to reason about or even know about). A database user outside of your application is more likely to be impeded from doing something destructive in the database if the lock comes from within the database, than if the lock is on a file that is possibly unknown to some consumers of the DB.
Dave
|
|---|