title: What is the pro's and con's of locking the actual file vs an empty lock file?
body: <p>My program is writing to a binary file, and there could be multiple instances of the program accessing the same binary file for the same user. In Unix/Linux, I see some programs (particularly daemon processes) locking an empty lock file instead of the actual shared data that needs to be locked (so instead of locking <code>~/.data/foo</code> they lock <code>~/.data/foo.lck</code>). What are the pros and cons of locking the actual file vs an empty lock file?</p>