Solving the Santa Claus Concurrency Puzzle with SPIN Model Checker
Solving Santa Claus Puzzle

I explored the classic Santa Claus concurrency puzzle using the SPIN model checker and Promela to validate synchronization logic. Instead of jumping to a solution, I first engineered three failure scenarios to expose subtle bugs in group marshalling and priority handling. This approach revealed how easily correct-seeming code fails under complex interleavings, proving that model checking offers superior coverage over traditional testing for concurrency challenges.
I expected this to be a simple problem. What surprised me is how easy it is to get it wrong.
- gradschool
The problem as stated seems ill posed to me. If Santa wakes up when
either quorum is ready, then it's never true that both are waiting
unless they arrive simultaneously. Either that's a zero probability
event that can be safely ignored, or it needs to be handled by
arbitration in some form. Attempting to resolve contention by giving
preference to one or the other shifts the problem to that of
determining whether they're close enough to be considered
simultaneous, with edge cases needing to be resolved by arbitration,
and so on.
- phouchguk
I really like this solution: https://www.cs.otago.ac.nz/staffpriv/ok/santa/index.htm
- xeyownt
I think the real puzzle is to understand what is the puzzle.