Two requests arrive at the same instant to book the last seat. Both read "1 available". Walk me through what happens and how you stop it.

Answer it out loud before you open anything. The value of the flags below is in comparing them to what you actually said.

The situation behind the question

The handler reads the seat count, checks it is greater than zero, decrements it in application code, and writes the new value back.

What it is really testing

Whether the candidate recognises read-modify-write as the shape of the bug and can name several mechanisms with their real costs, rather than reciting "use a transaction".

Where the mechanism is taught