check then act

Reading whether something exists and then acting on the answer as two separate steps, which races under concurrency.

In more detail

Two workers can both check, both see nothing, and both act. Replace it with one atomic step: a unique constraint, a conditional write or a locking read.

Related terms

Taught in

References