Atomic means indivisible
Software Lock:
context switch may happen after line 2
if there is no one in critical section, P1 should not be busy waiting
if the intent is assigned with true, then a context switch happens, P1 & P2 will be busy waiting forever.
This is the software approach.
Disable Interrupts:
TSL
This move is atomic
Semaphores