Race conditions and atomic operations