Process 1 opens file IN, "out.txt"; Process 1 locks file OUT Process 2 opens file IN, "out.txt"; Process 2 locks file OUT Process 2 reads the value "100" from IN Process 2 writes the value "101" to OUT In any order (or atomically): Process 2 closes IN (thereby unlocking it) Process 2 closes OUT (thereby unlocking it) Process 2 rename "out.txt" to "in.txt"