File Locking vs. Semaphores <p>Just out of curiosity, what is the preferred way to achieve interprocess synchronization on Linux? The <code>sem*(2)</code> family of system calls seem to have a very clunky and dated interface, while there are three ways to lock files - <code>fcntl()</code>, <code>flock()</code> and <code>lockf()</code>.</p> <p>What are the internal differences (if any) and how would you justify the usage of each?</p>