The problem is you do need some sort of atomic locking. There's nothing preventing both your processes from simultaneously obtaining "not locked" results from the file.
- Process A opens and reads the unlocked status
- Process A gets put to sleep
- Process B starts running
- Process B opens and reads the unlocked status
- B writes the locked status into the file and gets put to sleep
- A writes the locked status into the file and starts on its way
- B wakes up and hilarity ensues!