~learn.
0:00 / 1:25
Side quest 16 · BookMyShow

Two families, the same two seats, the same second

transcript

Family A taps H5 to H8. Family B taps H7 to H10. Same instant. Both want H7 and H8. Who gets them?

Lock seat by seat? Two families lock overlapping rows in different orders. Deadlock. Check, then write? Both read H7 as free. Both think they have it. And someone puts their phone down on the pay page. Seats blocked all evening.

The fix: every change for a show goes to one place. And it runs in one atomic step. All the seats, or none.

Both requests go to the show's one writer. Family A's runs first. Is every seat free? Yes. Hold all four. Family B's runs next. H7 is taken. So it holds nothing.

Family B is told exactly which seats went. Not even H9 and H10 are held. They stay free for someone else. Their map refreshes, and they pick again.

And the phone put down? A hold isn't a lock. It's a state. Its expiry lives on the seat. After 8 minutes, it simply counts as free.

A family wants four seats together. Not two and a stray. One writer per show. All the seats, or none.

Full breakdown in the lecture.