Liveness


In concurrent computing, liveness refers to a set of properties of concurrent systems, that require a system to make progress despite the fact that its concurrently executing components may have to "take turns" in critical sections, parts of the program that cannot be simultaneously run by multiple processes. Liveness guarantees are important properties in operating systems and distributed systems.
More generally, a liveness property states that "something good will eventually occur", contrasting a safety property which states that "something bad does not occur".
If a safety property is violated there is always a finite execution that shows the violation, but a liveness property cannot be violated in a finite execution of a distributed system because the "good" event might still occur at some later time.
Eventual consistency is an example of a liveness property. All linear time properties can be expressed as the intersection of safety and liveness properties. Whereas the violation of a given safety property admits a finite witness, violation of liveness properties may be harder to establish as no finite witness can be used as proof.

Forms of liveness

Several forms of liveness are recognized. The following ones are defined in terms of a multi-process system that has a critical section, protected by some mutual exclusion device. All processes are assumed to correctly use the mutex; progress is defined as finishing execution of the critical section.
According to B. Alpern, deadlock-freedom is a safety property. Alpern presumes that the states of the system can be split between states wherein deadlock is present and states wherein no deadlock is in place. The property that states that the system remains forever in green states is a safety property. If one cannot distinguish between green and red states, however, the property that says that eventually one of the processes in the system will evolve is a liveness property.

Formal distinction

The distinction between safety and liveness can be formally established through a predicate, where refers to time.
Let be the instant of time starting from which the liveness and safety properties are evaluated. In the examples below, let be a process that one wants to assure that is deadlock free.
Safety:
Example: means " is in a deadlock state at time ".
Liveness:
Example: means " stops waiting at time ".

Bounded bypass and bounded overtaking

It is also worth noting that the distinction between the liveness property of bounded bypass and the safety property of bounded overtaking is subtle. Starvation freedom together with bounded overtaking implies bounded bypass. Bounded overtaking means that after a tagged process declares the interest in entering the critical section, each other process will overtake the tagged process a bounded number of times before the tagged process enters the critical section. Note that if the tagged process is never granted the permission to enter its critical section, bounded overtaking may still hold. Therefore, bounded overtaking, by itself, is not a liveness property. In a deadlocked system, bounded overtaking trivially holds, as no process overtakes the other, but bounded bypass doesn't.