A Tour of Temporal Typing Liveness & Fairness · 4/5
Liveness & Fairness · Page 4 of 5

Strong Fairness

Weak fairness is not always enough.

Suppose three processes compete for a Mutex. Process p1 enters waiting, while p2 repeatedly requests, acquires, and releases the lock. Whenever p2 holds the lock, acquire(p1) is disabled — so acquire(p1) is never continuously enabled! Under weak fairness alone, p1 can starve forever.

strong_fairness(s.acquire(p)) — TLA⁺'s SFvars(acquire(p)) — says: if an action is enabled infinitely often (even if repeatedly interrupted), it must eventually happen.

Combined with weak_fairness(s.release(p)), strong fairness on acquire proves starvation_free: every waiting process eventually becomes the holder.

Try it: Click Check to verify starvation_free passes across all 20 states. Now replace strong_fairness with weak_fairness on line 34 and click Check — watch the checker produce the exact starvation cycle where p1 waits forever while p2 hogs the lock!
Click Check (or press Shift+Enter) to run the front-end and check this specification. Switch to TLA⁺ to view its TLA⁺ meaning.
---- MODULE Mutex ----
CONSTANT procs
VARIABLES holder, waiting
vars == <<holder, waiting>>

Fair == \A p \in procs : SF_vars(Acquire(p)) /\ WF_vars(Release(p))
Spec == Init /\ [][Next]_vars /\ Fair

StarvationFree == \A p \in procs : (p \in waiting) ~> (holder = p)
====