So long as this file exists, no program should try to access the folder. This is an exclusive lock only. It is easy to write a shell script to do this kind of file locking. This is also an exclusive lock. 3. fcntl locking.
Databases require areas of a file to be locked.
Same as fcntl , but locks whole files. However consider if two programs running simultaneously executed line 4 at the same time. Both would think that the lock did not exist and proceed to line 5. The kill command is then useful for checking if a process is running. Sending the 0 signal does nothing to the process, but fails if the process does not exist.