Fairness
Fairness constrains complete executions so that eligible participants, messages, or actions are not postponed forever under the stated assumptions.
Fairness refines liveness. It does not state that every action is safe, that completion has a finite time bound, or that resources are allocated equally. It identifies which starvation-like executions are excluded from the model.
Common Forms
- Weak fairness or justice: an action that remains continuously enabled from some point onward eventually occurs.
- Strong fairness or compassion: an action enabled infinitely often eventually occurs.
- Process fairness: an eligible participant eventually receives execution opportunity.
- Message fairness: a message that remains deliverable is eventually admitted or received.
- Choice fairness: an alternative that remains eligible is not ignored forever.
- Probabilistic fairness: starvation has probability zero under a declared stochastic model, which is weaker than a per-execution guarantee.
Fairness claims are boundary- and failure-relative. A message cannot remain deliverable across a permanent partition under a model that treats the link as unavailable. A crashed participant is not continuously enabled unless recovery is part of the fairness assumption. Priority, cancellation, expiry, leases, and resource exhaustion can also change eligibility.
Fairness can exclude starvation among enabled actions, but it does not by itself break deadlock or prove that useful work completes. In a deadlock, the required action may no longer be enabled; in a livelock, fair execution may continue to select actions that collectively make no useful progress.
Formal Definitions
Fairness is stated over the runs of a state machine using the eventually () and always () operators of linear temporal logic. Let be an action, a set of transitions such as one participant's step, one message's delivery, or one alternative of a choice. Two predicates describe how stands at position of a run :
The fairness conditions differ in how often must be enabled before it must be taken:
Weak fairness says that if is eventually enabled forever, it is taken infinitely often. Strong fairness says that if is enabled infinitely often, even with interruptions, it is taken infinitely often. Equivalent forms make the excluded runs explicit:
Weak fairness excludes runs in which stays enabled and is never taken. Strong fairness also excludes runs in which keeps becoming enabled and is never taken. Since implies , strong fairness implies weak fairness, and unconditional fairness implies both.
The difference matters whenever enabling is intermittent:
| Situation | Weak fairness | Strong fairness | |
|---|---|---|---|
| A request waits on an idle worker that stays idle | eventually always | guarantees service | guarantees service |
| A request waits on a lock that is released and immediately reacquired by others | infinitely often, never continuously | permits starvation | guarantees acquisition |
| A message is retransmitted over a lossy link | infinitely often | permits loss forever | guarantees delivery |
The third row is the fair-loss link assumption of distributed computing: a message sent infinitely often is delivered infinitely often. It is a strong-fairness assumption about the network, not a property the sender can enforce.
Fairness conditions constrain only infinite behavior. Every finite prefix of a run can be extended to a fair run, so fairness never forbids a finite history. In the terms of safety and liveness, it is a liveness property. When fairness is imposed on actions of the machine itself, the specification is machine closed: the fairness condition adds no safety constraint beyond those of the transitions.
Unbounded Delay
Fairness guarantees eventuality without necessarily giving a finite uniform bound. For every integer n, a request may be delayed for more than n steps while still being guaranteed eventual service in every admissible execution.
König's lemma explains why this does not fit a naive finitely branching tree in which all branches are admitted. If such a tree contains arbitrarily long finite branches, it contains an infinite branch. Unbounded fair service therefore excludes the infinite starvation branch as inadmissible even though every finite prefix can still be extended to a fair execution.
work^0 ; service
work^1 ; service
work^2 ; service
...
work^infinity -- excluded as unfairFairness is consequently a property of whole paths or their infinite tails, not a safety property witnessed by one finite bad prefix.
Scheduling and Search
Scheduling generates a concrete execution by selecting among enabled occurrences. Fairness restricts the allowed scheduler behaviors. Different layers can have different fairness claims: CPU scheduling, runtime tasks, actor activations, message delivery, broker assignments, workflow steps, locks, and retries do not inherit fairness automatically from one another.
Fairness also matters in relational and logic programming. A depth-first search can follow one infinite branch and permanently hide answers elsewhere. Interleaved or breadth-oriented search can improve answer fairness while changing memory, latency, and ordering behavior.
Fairness, Consensus, and Consistency
Consensus safety must hold regardless of fair scheduling. Consensus termination usually depends on additional liveness assumptions such as eventual message delivery, quorum availability, partial synchrony, randomized progress, or eventual leadership.
Most consistency models constrain history safety rather than scheduling fairness. A history can be linearizable even when an operation starves. Eventual convergence adds liveness assumptions about delivery, reconciliation, and continued execution that should be named separately.
Modeling Checks
- Which participant, message, action, or choice is protected from starvation?
- What does enabled or eligible mean at this boundary?
- Is fairness weak, strong, probabilistic, or mechanism-specific?
- Which failures, cancellations, priorities, or resource limits suspend the guarantee?
- Is completion merely eventual or bounded by time, steps, turns, or queue positions?
- Is fairness assumed by the semantic model, supplied by a runtime, or only expected operationally?
- Does safety hold even on unfair executions?
External References
- Zohar Manna and Amir Pnueli, The Temporal Logic of Reactive and Concurrent Systems: Specification, Springer, 1992.
- Martín Abadi and Leslie Lamport, The Existence of Refinement Mappings, Theoretical Computer Science 82(2):253-284, 1991.
- Nissim Francez, Fairness, Springer, 1986.
- Daniel Lehmann, Amir Pnueli, and Jonathan Stavi, Impartiality, Justice and Fairness: The Ethics of Concurrent Termination, in Automata, Languages and Programming, LNCS 115:264-277, 1981.