+ ExplanationThe correct answer is D. This is a very tough question, and one you’re not likely to find in the real exam—but that’s why you’re reading this book! You must remember that flock() uses a “cooperative” locking mechanism with one big assumption: that all other processes that want to access your file will also use flock(). If they don’t, race conditions can arise and the lock is not guaranteed. Curiously, creating a directory with the mkdir function is guaranteed to be an atomic operation, meaning that only one process at any given time can perform it. Therefore, you can create a temporary directory and “hold it” until you have finished your I/O operations.