menuTicketing

Request × Key-State Matrix

A (Acquire)

Key stateServer actionResponseTiming
Not registeredRegister (expiry = now+lease), issue tokenA+token+keyImmediately
Registered + expiry passedRenew (now+lease), new tokenA+token+keyImmediately
Registered + valid (held)Register on wait queue, hold responseA+token+key or T+keyThe moment it's acquired via release/expiry, or T if wait is exceeded
  • The release path is FIFO-fair: when the holder does R, it's handed directly to the waiter at the front of the queue (no re-contention, a new token).
  • Only the expiry path is non-FIFO. No re-entrancy (the same client doing A again on a key it already holds → goes to the wait queue).

R (Release)

Key stateServer actionResponse
Registered, has waitersHand off directly to the waiter at the front (new token)R+key
Registered, no waitersDelete the keyR+key
Not registeredNothingN+key