Cohesive Systems logoCOHESIVE SYSTEMS

Search Cohesive Systems

Ready

Search Cohesive Systems

Find product pages, building blocks, technical articles, and graph definitions.

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 (F\mathbf{F}) and always (G\mathbf{G}) operators of linear temporal logic. Let AA 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 AA stands at position ii of a run s0→s1→⋯s_0 \to s_1 \to \cdots:

enabledA holds at i  ⟺  (si,s′)∈A for some state s′takenA holds at i  ⟺  (si,si+1)∈A\begin{aligned} \mathit{enabled}_A &\text{ holds at } i \iff (s_i, s') \in A \text{ for some state } s' \\ \mathit{taken}_A &\text{ holds at } i \iff (s_i, s_{i+1}) \in A \end{aligned}

The fairness conditions differ in how often AA must be enabled before it must be taken:

unconditional fairness:G F takenAweak fairness:WF(A)  ≡  F G enabledA  →  G F takenAstrong fairness:SF(A)  ≡  G F enabledA  →  G F takenA\begin{aligned} \text{unconditional fairness:} \quad & \mathbf{G}\,\mathbf{F}\,\mathit{taken}_A \\ \text{weak fairness:} \quad \mathrm{WF}(A) \;\equiv\; & \mathbf{F}\,\mathbf{G}\,\mathit{enabled}_A \;\rightarrow\; \mathbf{G}\,\mathbf{F}\,\mathit{taken}_A \\ \text{strong fairness:} \quad \mathrm{SF}(A) \;\equiv\; & \mathbf{G}\,\mathbf{F}\,\mathit{enabled}_A \;\rightarrow\; \mathbf{G}\,\mathbf{F}\,\mathit{taken}_A \end{aligned}

Weak fairness says that if AA is eventually enabled forever, it is taken infinitely often. Strong fairness says that if AA is enabled infinitely often, even with interruptions, it is taken infinitely often. Equivalent forms make the excluded runs explicit:

WF(A)≡G F (¬enabledA∨takenA)SF(A)≡F G ¬enabledA  ∨  G F takenA\begin{aligned} \mathrm{WF}(A) &\equiv \mathbf{G}\,\mathbf{F}\,(\lnot\mathit{enabled}_A \lor \mathit{taken}_A) \\ \mathrm{SF}(A) &\equiv \mathbf{F}\,\mathbf{G}\,\lnot\mathit{enabled}_A \;\lor\; \mathbf{G}\,\mathbf{F}\,\mathit{taken}_A \end{aligned}

Weak fairness excludes runs in which AA stays enabled and is never taken. Strong fairness also excludes runs in which AA keeps becoming enabled and is never taken. Since F G P\mathbf{F}\,\mathbf{G}\,P implies G F P\mathbf{G}\,\mathbf{F}\,P, strong fairness implies weak fairness, and unconditional fairness implies both.

The difference matters whenever enabling is intermittent:

SituationenabledA\mathit{enabled}_AWeak fairnessStrong fairness
A request waits on an idle worker that stays idleeventually alwaysguarantees serviceguarantees service
A request waits on a lock that is released and immediately reacquired by othersinfinitely often, never continuouslypermits starvationguarantees acquisition
A message is retransmitted over a lossy linkinfinitely oftenpermits loss foreverguarantees 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 unfair

Fairness is consequently a property of whole paths or their infinite tails, not a safety property witnessed by one finite bad prefix.

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