Things Unix can do atomically (2010)
The rename system call is not quite atomic. From <a href="https://linux.die.net/man/2/rename" rel="nofollow noreferrer">https://linux.die.net/man/2/rename</a>:<p>> <i>However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed.</i><p>A better way to think about rename is that it's given by two atomic operations in sequence: (1) An atomic link call to make the file available under the new name, and then
(2) an atomic remove operation to delete the old name. Thus, it's possible to observe the state after (1) but before (2).