text
stringlengths 2
132k
| source
dict |
|---|---|
which is trusted by everybody. This failure detector was shown to be equivalent to 3S in the proof that it is the weakest to solve consensus [Chu 1998]. Aguilera et al. [2000b] presented a failure detector called heartbeat which is use-ful in designing protocols which are quiescent , i.e., which eventually stop sending messages. Garg and Mitchell [1998b] define the infinitely often accurate failure detector (denoted 23 P) in the context of predicate detection in faulty systems [Garg and Mitchell 1998a]. The anonymously perfect failure detector (denoted ? P)[Guerraoui 2002; Charron-Bost and Toueg 2001] is useful in the context of solving 12 · Freiling, Guerraoui, Kouznetsov non-blocking atomic commit. This failure detector is just like a perfect failure de-tector, only that it does not output the identities of the failed processes; it merely outputs a boolean value whether or not some process has crashed. We will return to this failure detector later in this section. 2.2.7 Justifying Unreliable Failure Detectors. Assuming unreliable failure de-tectors is much more realistic than assuming a perfect failure detector, because the properties of unreliable failure detectors can be more easily guaranteed in practice than those of perfect failure detectors. It is a common experience that networks perform synchronously “most of the time”. This means that the system alternates between short periods of instability (i.e., where no timing guarantees can be made) and long periods of stability (i.e., where the system behaves as if it were synchronous). Measurements by Cristian and Fetzer have shown that the ratio between the average length of a stable period to that of an unstable period is [[ 341 : 1 ]] on a standard local area network. The bottom line of this observation is that failure detection can be implemented perfectly “most of the time”. The average length of
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
a stable period was [[ x seconds, ]] a time which is usually sufficient for an algorithm to terminate, e.g., a transaction to commit. Therefore, an arguably assumption is that the system is synchronous “forever” after an initial finite time of asynchrony. This is captured in what became known as the assumption of partial synchrony [Dwork et al. 1988]. There are two possible variants of partial synchrony, which we will exemplify using the communication bound ∆: (1) Either ∆ is known but holds only eventually, or (2) ∆ exists but is not known. Analogous definitions of partially synchronous processes can easily be derived using bound δ instead of ∆. Both variants of partial synchrony reflect the difficulty of choosing a system’s timing parameters in practice. The first form, namely that timing bounds hold eventually, directly reflects the findings from the study of Cristian and Fetzer because it is highly improbable that an algorithm starts in a stable period and ends in an unstable period. The second variant reflects the fact that it is often safe to assume that some upper bound on message delivery time exists; the difficult question is how large this bound actually is. Interestingly, both forms of partial synchrony allow consensus to be solved, even if both communication and processes are partially synchronous [Chandra and Toueg 1996] and even if merely the ratio between best-case and worst-case round trip de-lay is bounded [Jean-Fran¸ cois Hermant and Josef Widder ]. In terms of failure detectors, such partially synchronous systems allow to implement eventually per-fect failure detectors [Chandra and Toueg 1996]. Hence, reasoning with eventually perfect failure detectors can be justified in practice. 2.2.8 Using and Combining Different Failure Detector Abstractions. The use of failure detectors can relegate much of the intrinsic knowledge of the network into lower
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
layers and leave the application only with those issues which it needs to care The Failure Detector Abstraction · 13 about: reasoning about failures. System engineers only need to agree on the inter-face of the particular failure detector in question, and two groups can independently go about designing solutions: one group can start building an application given a particular failure detector semantics, the other group can choose a network archi-tecture and a failure detection algorithm such that the failure detector semantics are satisfied. Implementing failure detection as a service has another advantage since one im-plementation of, say, an eventually perfect failure detector can be used by multiple applications simultanteously. Dissemination of failure detection messages and keep-ing track of timeouts can be done centrally at a “middleware” layer which is usually much more efficient than having every application do this on its own. Moreover, if timeouts are tweaked or adapted, this may be done centrally in the service layer instead of adapting all different algorithms independently. Failure detectors can also be used as sources of activation in event-driven ap-plications. For example, Aguilera et al. investigate quiescent algorithms ,i.e., algorithms which eventually stop sending messages. They show that failure detection has no quiescent solutions, but special failure detectors can be used as a service to build quiescent algorithms (like quiescent reliable broadcast [Aguilera et al. 2000b]) and terminating ones (like consensus) at higher layers. > non-blocking atomic commit (vote i)is send 〈pi,vote i〉to all wait until ∀j∈ { 1, . . . , n }:received 〈pj,vote j〉or > ∈ ?P > if > ∈ ?Por ∃j∈ { 1, . . . , n }:vote j=no then > outcome i:= consensus (abort ) > else > outcome i:= consensus (commit ) > endif return (outcome i) > end > Fig. 3. Implementing
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
non-blocking atomic commit using ? Pand a consensus abstraction [Guer-raoui 2002]. Finally, we argue here that failure detectors also remedy the problems of asym-metric or differing timeouts within an application which was discussed at the end of the previous section. While failure detectors do not offer timing information per se , different instantiations can separate the concerns of differing timeouts within an application. In the 3PC algorithm discussed earlier, it was noted that during the first phase of the algorithm it made sense to have a more conservative (i.e., longer) timeout to increase the chances that all processes vote yes . During the remainder of the algorithm, a more aggressive timeout can be used because false suspicions merely delay the outcome of the algorithm. These two different concerns can be captured using two different types of failure detectors. It the first phase, it is not important which process failed, so the anonymously perfect failure detector ? P is sufficient (recall that ? P outputs ⊥ if no process has failed and > if some process has failed). In the second phase (including the election within the termination protocol), it is important to be able to suspect particular processes (especially the coordinator process), so a failure detector 3P or 3S can be used given a majority 14 · Freiling, Guerraoui, Kouznetsov of correct processes. In fact, the latter failure detector can be encapsulated within a solution for consensus and non-blocking atomic commit can be formulated in a surprisingly simple algorithm with only half a dozen lines (see Fig. 3). Hence, failure detectors even offer fine-grained abstractions where necessary. 2.3 Summary In this section we have argued that failure detectors are useful abstractions from an engineering point of view. Firstly, they can be used to hide timeout details behind a clean operational
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
interface which makes it easier to design, build and analyse fault-tolerant distributed systems. Secondly, implementation of the failure detection functionality can be done in a centralized, re-useable fashion which enables solutions which are more efficient compared to situations in which every application performs failure detection independently. Finally, failure detectors offer the possibility to express timing assumptions in a fine-grained manner which is more suitable to be used directly by application logic than explicit timing information. 3. FAILURE DETECTORS AS A COMPUTABILITY BENCHMARK Failure detector is a means to abstract out time in distributed programming. Aprogram assuming a failure detector D works in any physical model where D is implementable. In a sense, a failure detector hides the synchrony guarantees of the underlying model from the programmer. The principal theoretical question here is what are the minimal synchrony assumptions sufficient to solve a given problem M , or, in other words, the weakest failure detector to solve M .In the next section (Section 3.1), we present formally the model of an asyn-chronous system with failure detectors and give a few examples of failure detectors. In the following sections (Sections 3.2, 3.3 and 3.4), we discuss the weakest fail-ure detector question in the context of three fundamental problems in distributed computing: solving consensus (see Section 2.2.4 for a definition), implementing read-write shared memory in a message-passing system and solving non-blocking atomic commitment (NBAC). 3.1 Model In this chapter, we describe the asynchronous message-passing model equipped with a failure detector [Chandra et al. 1996]. Processes. The system consists of a set of n processes Π = {p1, p 2, . . . , p n} (n > 1). Every pair of processes is connected by a reliable channel. Processes communicate by reliable message passing. Failures and failure patterns. Processes are subject to crash
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
failures. We do not consider Byzantine failures: a process either correctly executes the algorithm assigned to it, or crashes and stops forever executing any action. A process that does not crash in a given execution is called correct . A process that is not correct is called faulty . A failure pattern F , a proper subset of Π, describes the set of processes that are faulty in the same execution. An environment E, a set of failure patterns, describes sets of processes that are allowed to fail in the same execution. A failure detector history H with range R is an infinite sequence ( pi1 , d 1),( pi2 , d 2), . . . ,where for all j ∈ N, pij ∈ Π and dj ∈ R . Informally, H represents the order in The Failure Detector Abstraction · 15 which processes pi1 ,pi2 ,. . . “see” failure detector outputs d1,d2,. . . . For a given fail-ure pattern F , we say that a set S of failure detector histories is F -complete if S satisfies the following properties: (1) For every infinite sequence σ of process identifiers pi1 , p i2 , . . . in which processes in F appear finitely often and processes in Π \ F appear infinitely often, S contains a failure detector history ( pi1 , d 1), (pi2 , d 2), . . . .(2) Let H ∈ S, and H′ be any failure detector history obtained from H by removing finitely many elements. Then H′ ∈ S.Let k ∈ N and H = ( pi1 , d 1), (pi2 , d 2), . . . be a failure detector history. We say that a process p is faulty in step k of H if p appears in H
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
only before its k-th element, i.e., ∀k′ ≥ k, pik′ 6 = p. Failure detectors. A failure detector D with range RD is a function that maps each failure pattern F to an F -complete set of failure detector histories with range RD . D(F ) is thus the set of failure detector histories permitted by D for failure pattern F . Note that we do not make any assumption a priori on the range of a failure detector. When any process p performs a step of computation, it can query its failure detector module of D, denoted Dp, and obtain a value d ∈ R D that encodes some information about failures. If D and D′ are failure detectors, ( D, D′) denotes the failure detector that outputs a vector with two components, the first being the output of D and the second being the output of D′. Formally, R(D,D′) = RD × R D′ , and for each F , ˜H ∈ (D, D′)( F ) ⇔ ˜H = ( H, H ′), H ∈ D (F ), H′ ∈ D ′(F ). Now we introduce a few popular failure detectors in the model we just described: —The perfect failure detector P [Chandra and Toueg 1996] outputs a set of sus-pected processes at each process. P ensures strong completeness : every crashed process is eventually suspected by every correct process, and strong accuracy : no process is suspected before it crashes. Formally, RP = 2 Π and, for each failure pattern F , and each history H =(pi1 , d 1), (pi2 , d 2), . . . ∈ P (F ) ⇔ ( ∃k ∈ N ∀p ∈ F ∀k′ ≥ k : p ∈ dk′ ) ∧ ( ∀k ∈ N (( p ∈ dk) ⇒
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
(∀k′ ≥ k : p 6 = pik′ )) ) —The eventually perfect failure detector 3P [Chandra and Toueg 1996] also outputs a set of suspected processes at each process. But the guarantees provided by 3P are weaker than those of P. There is a time after which 3P outputs the set of all faulty processes at every non-faulty process. More precisely, 3P satisfies strong completeness and eventual strong accuracy : there is a time after which no correct process is ever suspected. Formally, R3P = 2 Π and, for each failure pattern F , and each history H =(pi1 , d 1), (pi2 , d 2), . . . ∈ 3P(F ) ⇔∃k ∈ N ∀k′ ≥ k : dk′ = F16 · Freiling, Guerraoui, Kouznetsov —The leader failure detector Ω [Chandra et al. 1996] outputs the identifier of a process at each process. There is a time after which it outputs the identifier of the same non-faulty process at all non-faulty processes. Formally, RΩ = Π and, for each failure pattern F , and each history H =(pi1 , d 1), (pi2 , d 2), . . . ∈ Ω( F ) ⇔∃k ∈ N ∃q ∈ Π \ F ∀k′ ≥ k : dk′ = q —The quorum failure detector Σ [Delporte-Gallet et al. 2003] outputs a set of pro-cesses at each process. Any two sets (output at any times and at any processes) intersect, and eventually every set consists of only non-faulty processes. Formally, RΣ = Π and, for each failure pattern F , and each history H =(pi1 , d 1), (pi2 , d 2), . . . ∈ Σ( F ) ⇔ (∀k, k ′ ∈ N dk ∩ dk′ 6 = ∅) ∧ (∃k ∈ N ∀k′ ≥ k d k′ ⊆ Π
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
\ F ). —The failure signal failure detector FS [Delporte-Gallet et al. 2004], originally called anonymously perfect failure detector in [Guerraoui 2002] outputs green or red at each process. As long as there are no failures, FS outputs green at every process; after a failure occurs, and only if it does, FS must eventually output red permanently at every non-faulty process. Formally, RFS = {green , red } and, for each failure pattern F , and each history H = ( pi1 , d 1), (pi2 , d 2), . . . ∈ FS (F ) ⇔ (∀k ∈ N (dk = red ⇒ (∃p ∈ F ∀k′ ≥ k : p 6 = pik′ )) ) ∧ (F 6 = ∅ ⇒ ∃ k ∈ N ∀k′ ≥ k d k′ = red ). Algorithms. The asynchronous communication channels are modeled as a mes-sage buffer which contains messages not yet received by their destinations. An algorithm A is a collection of n (possibly infinite state) deterministic automata, one for each process. A(p) denotes the automaton on which process p is running algorithm A. Computation proceeds in steps of A. In each step of A, process p performs atomically the following three actions: (i) p receives a single message addressed to p from the message buffer, or a null message, denoted λ (receive phase); (ii) p queries and receives a value from its failure detector module ( query phase); (iii) p changes its state and sends a message to a single process, according to the automaton A(p) ( send phase). Note that the received message is chosen non-deterministically from the messages in the message buffer destined to p, or the null message λ. Configurations, schedules, and runs. A configuration defines the current state of each process in the system and
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
the set of messages currently in the message buffer. Initially, the message buffer is empty. A step ( p, m, d ) of an algorithm A is uniquely determined by the identity of the process p that takes the step, the message m received by p during the step ( m might be the null message λ), and the The Failure Detector Abstraction · 17 failure detector value d seen by p during the step. We assume that messages are uniquely identified. We say that a step e = ( p, m, d ) is applicable to a configuration C if and only if m = λ or m is in the message buffer of C. For a step e applicable to C, e(C)denotes the unique configuration that results from applying e to C.A schedule S of algorithm A is a (finite or infinite) sequence of steps of A. S⊥ denotes the empty schedule. We say that a schedule S is applicable to a configura-tion C if and only if (a) S = S⊥, or (b) S is applicable to C, S is applicable to S1, etc. For a finite schedule S applicable to C, S(C) denotes the unique configuration that results from applying S to C.A partial run of algorithm A in an environment E using a failure detector D is a tuple 〈F, I, S 〉 where F ∈ E , I is an initial configuration of A, S = ( pi1 , m 1, d 1), (pi1 , m 1, d 1), . . . , ( pik , m k, d k) is a finite schedule of A, applicable to I, such that (pi1 , d 1), ( pi1 , d 1), . . . , ( pik , d k) is a prefix of
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
a failure detector history H ∈ D (F ). A run of algorithm A in an environment E using a failure detector D is a tuple 〈F, I, S 〉 where F ∈ E , I is an initial configuration of A, and S = ( pi1 , m 1, d 1), (pi1 , m 1, d 1), . . . is an infinite schedule of A, applicable to I, such that ( pi1 , d 1), (pi1 , d 1), . . . is a failure detector history in D(F ), and every correct process receives every message sent to it. Problems and solvability. A problem is a predicate on a set of runs (usually defined by a set of properties that these runs should satisfy). An algorithm A solves a problem M in an environment E using a failure detector D if the set of all runs of A in E satisfies M. We say that a failure detector D solves problem M in E if there is an algorithm A which solves M in E using D. Reducibility. Let D and D′ be failure detectors, and E be an environment. If, for failure detectors D and D′, there is an algorithm TD′→D that transforms D′ into D in E, we say that D is weaker than D′ in E.If D E D′ but D′ E D, we say that D is strictly weaker than D′ in E. If D E D′ and D′ E D, we say that D and D′ are equivalent in E. If D E D′ and D′ E D, we say that D and D′ are incomparable in E.Algorithm TD′→D that emulates histories of D using histories of D′ is called a reduction algorithm . Note that TD′→D does not need
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
to emulate all histories of D;it is required that all the histories it emulates be histories of D. A weakest failure detector. We say that a failure detector D is the weakest failure detector to solve a problem M in an environment E if the following conditions are satisfied: (a) D is sufficient to solve M in E, i.e., D solves M in E, and (b) D is necessary to solve M in E, i.e., if a failure detector D′ solves M in E, then D is weaker than D′ in E.There might be a number of distinct failure detectors satisfying these conditions. (Though all such failure detectors are in the just defined sense equivalent.) Hence, it would be more technically correct to talk about a weakest failure detector to solve M in E.18 · Freiling, Guerraoui, Kouznetsov 3.2 The weakest failure detector for consensus In this section, we discuss the seminal “CHT result” obtained by Chandra et al. . We show that failure detector Ω is necessary for solving consensus in asyn-chronous message-passing systems in all environments, i.e., for all assumptions on when and where failures might occur. Combined with the algorithm that solves consensus using a failure detector equivalent to Ω given a majority of correct pro-cesses [Chandra and Toueg 1996], this result implies that Ω is the weakest failure detector for solving consensus given a majority of correct processes. 3.2.1 Overview of the reduction algorithm. Let E be any environment, D be any failure detector that can be used to solve consensus in E, and A be any algorithm that solves consensus in E using D. Our goal is to determine a reduction algorithm TD→ Ω that, using failure detector D and algorithm A, implements Ω in E. Recall that implementing Ω means outputting, at every process,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
the identifier of a process so that eventually, the identifier of the same correct process is output permanently at all correct processes. The basic idea underlying TD→ Ω is to have each process locally simulate the overall distributed system in which the processes execute several runs of A that could have happened in the current failure pattern and failure detector history. Every process then uses these runs to extract Ω. In the local simulations, every process p feeds algorithm A with a set of proposed values, one for each process of the system. Then all automata composing A are triggered locally by p which emulates, for every simulated run of A, the states of all processes as well as the emulated buffer of exchanged messages. Crucial elements that are needed for the simulation are (1) the values from failure detectors that would be output by D as well as (2) the order according to which the processes are taking steps. For these elements, which we call the stimuli of algorithm A, process p periodically queries its failure detector module and exchanges the failure detector information with the other processes. The reduction algorithm TD→ Ω consists of two tasks that are run in parallel at every process: the commmuncation task and the computation task . In the com-munication task, every process maintains ever-growing stimuli of algorithm A by periodically querying its failure detector module and sending the output to all other processes. In the computation task, every process periodically feeds the stimuli to algorithm A, simulates several runs of A, and computes the current emulated out-put of Ω. 3.2.2 Building a DAG. The communication task of algorithm TD→ Ω is presented in Figure 4. Executing this task, p knows more and more of the processes’ failure detector outputs and temporal relations
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
between them. All this information is pieced together in a single data structure, a directed acyclic graph (DAG) Gp.Informally, every vertex [ q, d, k ] of Gp is a failure detector value “seen” by q in its k-th query of its failure detector module. An edge ([ q, d, k ], [q′, d ′, k ′]) can be interpreted as “ q saw failure detector value d (in its k-th query) before q′ saw failure detector value d′ (in its k′-th query)”. DAG Gp has some special properties which follow from its construction. Let F ∈ E be the set of faulty processes in the current execution. Then: The Failure Detector Abstraction · 19 > Gp←empty graph > kp←0 > while true do > receive message mdp←query failure detector D > kp←kp+ 1 > if mis of the form ( q, G q, p )then Gp←Gp∪Gq > add [ p, d p, k p] and edges from all vertices of Gpto [ p, d p, k p] to Gp > send ( p, G p, q ) to all q∈Π > Fig. 4. Building a DAG: process p (1) The vertices of Gp are of the form [ q, d, k ] where q ∈ Π, d ∈ R D and k ∈ N.(2) If v′ = [ q, d, k ] and v′′ = [ q, d ′, k ′] are vertices of Gp, and k < k ′, then ( v, v ′) is an edge of Gp.(3) Gp is transitively closed: if ( v, v ′) and ( v′, v ′′ ) are edges of Gp, then ( v, v ′′ ) is also an edge of Gp.(4) Let g = [ q1, d 1, k 1] → [q2, d 2, k 2] → . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. be any path in G. Then H = ( q1, d 1) → (q2, d 2) → . . . is a partial failure detector history in D(F ). (5) For all correct processes p and q, and for every vertex v of Gp, there is a d ∈ R D and a k ∈ N such that eventually ( v, [q, d, k ]) is an edge of Gq .Note that properties (1)–(5) imply that, for every correct process p, k ∈ N, and set of paths V in Gp, eventually Gp contains a path g, such that (a) every correct process appears at least k times in g, and (b) for every path g′ in V , g′ · g is also a path in Gp.3.2.3 Simulation trees. Now DAG Gp can be used to simulate runs of A. Any path g = [ q1, d 1, k 1], [q2, d 2, k 2], . . . , [qs, d s, k s] through Gp gives the order in which processes q1, q2, . . . , q s “see”, respectively, failure detector values d1, d1, d 2, . . . , ds. That is, g contains an activation schedule and failure detector outputs for the processes to execute steps of A’s instances. Let I be any initial configuration of A.Consider a schedule S that is applicable to I and compatible with g, i.e., |S| = s and ∀k ∈ { 1, 2, . . . , s }, S[k] = ( qk, m k, d k), where mk is a message addressed to qk (or the null message λ). All schedules that are applicable to I and compatible with paths in Gp can be represented as a tree Υ Ip, called the simulation tree induced by
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Gp and I. The set of vertices of Υ Ip is the set of all schedules S that are applicable to I and compatible with paths in Gp. The root of Υ Ip is the empty schedule S⊥. There is an edge from S to S′ if and only if S′ = S · e for a step e; the edge is labeled e. Thus, every vertex S of Υ Ip is associated with a sequence of steps e1 e2 . . . e s consisting of labels of the edges on the path from S⊥ to S. In addition, every descendant of S in Υ Ip corresponds to an extension of e1 e2 . . . e s.The construction of Υ Ip implies that, for any vertex S of Υ Ip, there exists a partial run 〈F, I, S 〉 of A where F is the current failure pattern. Thus, if correct processes appear sufficiently often in S and receive sufficiently many messages sent to them, then every correct (in F ) process decides in S(I). 20 · Freiling, Guerraoui, Kouznetsov > [p2, d 2, k 2][p1, d 3, k 3]p1, d 1, k 1 > S⊥ > (a)(b) > (p2, m 2, d 2)(p1, m 3, d 3)(p2, λ, d 2)(p1, λ, d 3)(p1, λ, d 1) > Fig. 5. A DAG and a tree In the example depicted in Figure 5, a DAG (a) induces a simulation tree a portion of which is shown in (b). There are three non-trivial paths in the DAG: [p1, d 1, k 1] → [p2, d 2, k 2] → [p1, d 3, k 3], [ p2, d 2, k 2] → [p1, d 3, k 3] and [ p1, d 1, k 1] →
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
[p1, d 3, k 3]. Every path through the DAG and an initial configuration I induce at least one schedule in the simulation tree. Hence, the simulation tree has at least three leaves: (p1, λ, d 1) ( p2, m 2, d 2) ( p1, m 3, d 3), ( p2, λ, d 2) ( p1, m ′ > 3 , d 3), and (p1, λ, d 3). Recall that λ is the empty message: since the message buffer is empty in I, no non-empty message can be received in the first step of any schedule. 3.2.4 Tags and valences. Let Ii, i ∈ { 0, 1, . . . , n } denote the initial configuration of A in which processes p1, . . . , p i propose 1 and the rest (processes pi+1 , . . . , p n)propose 0. In the computation task of the reduction algorithm, every process p maintains an ever-growing simulation forest Υp = {Υ0 > p , Υ1 > p , . . . , Υnp } where Υ ip (0 ≤ i ≤ n) denotes the simulation trees induced by Gp and initial configurations Ii.For every vertex of the simulation forest, p assigns a set of tags . Vertex S of tree Υip is assigned a tag v if and only if S has a descendant S′ in Υ ip such that p decides v in S′(Ii). We call the set tags the valence of the vertex. By definition, if S has a descendant with a tag v, then S has tag v. Validity of consensus ensures that the set of tags is a subset of {0, 1}.Of course, at a given time, some vertices of the simulation forest Υ p might not have any tags because the simulation stimuli
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
are not sufficiently long yet. But this is just a matter of time: if p is correct, then every vertex of p’s simulation forest will eventually have an extension in which correct processes appear sufficiently often for p to take a decision. A vertex S of Υ ip is 0 -valent if it has exactly one tag {0} (only 0 can be decided in S’s extensions in Υ ip). A 1-valent vertex is analogously defined. If a vertex S has both tags 0 and 1 (both 0 and 1 can be decided in S’s extensions), then we say that S is bivalent .1 > 1The notion of valence was first defined by Fischer et al. as the set of values than are decided in all extensions of a given execution. Here we define the valence as only a subset of these values, defined by the simulation tree. The Failure Detector Abstraction # · 21 It immediately follows from Validity of consensus that the root of Υ 0 > p can at most be 0-valent, and the root of Υ np can at most be 1-valent (the roots of Υ 0 > p and Υ np cannot be bivalent). 3.2.5 Stabilization. Note that the simulation trees can only grow with time, they never shrink. As a result, once a vertex of the simulation forest Υ p gets a tag v, it cannot lose it later. Thus, eventually every vertex of Υ p stabilizes being 0-valent, 1-valent, or bivalent. Since correct processes keep continuously exchanging the failure detector samples and updating their simulation forests, every simulation tree computed by a correct process at any given time will eventually be a subtree of the simulation forest of every correct process. Formally, let p be any correct process, i be any index in
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
{0, 1, . . . , n }, and S be any vertex of Υ ip. Then: (i) There exists a non-empty V ⊆ { 0, 1} such that eventually the valence of S is permanently V . (We say that the valence of S stabilizes on V at p.) (ii) If the valence of S stabilizes on V at p, then for every correct process q, even-tually S is a vertex of Υ iq and the valence of S stabilizes on V at q.Hence, the correct processes eventually agree on the same tagged simulation subtrees. In discussing the stabilized tagged simulation forest, it is thus convenient to consider the limit infinite DAG G and the limit infinite simulation forest Υ = {Υ0, Υ1, . . . , Υn} such that for all i ∈ { 0, 1, . . . , n } and all correct processes p, Gp tends to G and Υ ip tends to U psilon i.3.2.6 Critical index. Let p be any correct process. We say that index i ∈{1, 2, . . . , n } is critical if either the root of Υ i is bivalent or the root of Υ i−1 is 0-valent and the root of Υ i is 1-valent. In the first case, we say that i is bivalent critical . In the second case, we say that i is univalent critical . Lemma 3.1. There is at least one critical index in {1, 2, . . . , n }. Proof. Indeed, by the Validity property of consensus, the root of Υ 0 is 0-valent, and the root of Υ 1 is 1-valent. Thus, there must be an index i ∈ { 1, 2, . . . , n } such that the root of Υ i−1 is 0-valent,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
and Υ i is either 1-valent or bivalent. Since tagged simulation forests computed at the correct processes tend to the same infinite tagged simulation forest, eventually, all correct processes compute the same smallest critical index i of the same type (univalent or bivalent). Now we have two cases to consider for the smallest critical index: (1) i is univalent critical, or (2) i is bivalent critical. 3.2.7 Handling a univalent critical index Lemma 3.2. If i is univalent critical, then pi is correct. Proof. By contradiction, assume that pi is faulty. Then G contains an infinite path g in which pi does not participate and every correct process participates infinitely often. Then Υ i contains a vertex S such that pi does not take steps in S and some correct process p decides in S(Ii). Since i is 1-valent, p decides 1 in S(Ii). But pi is the only process that has different states in Ii−1 and Ii, and 22 · Freiling, Guerraoui, Kouznetsov pi does not take part in S. Thus, S is also a vertex of Υ i−1 and p decides 1 in S(Ii−1). But the root of Υ i−1 is 0-valent — a contradiction. 3.2.8 Handling a bivalent critical index. Assume now that the root of Υ i is bivalent . Below we show that Υ i then contains a decision gadget , i.e., a finite subtree which is either a fork or a hook (Figure 6). > S0 > (0-valent) > S(bivalent) (q, m, d ) > S⊥ > S0 > (0-valent) > S1 > (1-valent) > S(bivalent) (q, m, d ′) > S⊥ > S1 > (1-valent) (q′, m ′, d ′) > (a) (b) > S′ > (q, m, d )(q′, m ′, d ′) > Fig. 6. A fork and a hook A
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
fork (case (a) in Figure 6) consists of a bivalent vertex S from which two different steps by the same process q, consuming the same message m, are possible which lead, on the one hand, to a 0-valent vertex S0 and, on the other hand, to a 1-valent vertex S1.A hook (case (b) in Figure 6) consists of a bivalent vertex S, a vertex S′ which is reached by executing a step of some process q, and two vertices S0 and S1 reached by applying the same step of process q′ to, respectively, S and S′. Additionally, S0 must be 0-valent and S1 must be 1-valent (or vice versa; the order does not matter here). In both cases, we say that q is the deciding process , and S is the pivot of the decision gadget. Lemma 3.3. The deciding process of a decision gadget is correct. Proof. Consider any decision gadget γ defined by a pivot S, vertices S0 and S1 of opposite valence and a deciding process q. By contradiction, assume that q is faulty. Let g, g0 and g1 be the simulation stimuli of, respectively, S, S0 and S1.Then G contains an infinite path ˜ g such that (a) g · ˜g, g0 · ˜g, g1 · ˜g are paths in G,and (b) q does not appear and the correct processes appear infinitely often in g.Let γ be a fork (case (a) in Figure 6). Then there is a finite schedule ˜S compatible with a prefix of ˜ g and applicable to S(Ii) such that some correct process p decides in S · ˜S(Ii); without loss of generality, assume that p decides 0. Since q is the only process that can distinguish S(Ii) and S1(Ii), and q does not appear in ˜S, ˜S is also applicable to
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
S1(Ii). Since g1 · ˜g is a path of G and ˜S is compatible with a prefix The Failure Detector Abstraction · 23 of ˜ g, it follows that S1 · ˜S is a vertex of Υ i. Hence, p also decides 0 in S1 · ˜S(Ii). But S1 is 1-valent — a contradiction. Let γ be a hook (case (b) in Figure 6). Then there is a finite schedule ˜S compatible with a prefix of g and applicable to S0(Ii) such that some correct process p decides in S0 · ˜S(Ii). Without loss of generality, assume that S0 is 0-valent, and hence p decides 0 in S0 · ˜S(Ii). Since q is the only process that can distinguish S0(Ii) and S1(Ii), and q does not appear in ˜S, ˜S is also applicable to S1(Ii). Since g1 · ˜g is a path of G and ˜S is compatible with a prefix of ˜ g, it follows that S1 · ˜S is a vertex of Υi. Hence, p also decides 0 in S1 · ˜S(Ii). But S1 is 1-valent — a contradiction. Now we need to show that any bivalent simulation tree Υ i contains at least one decision gadget γ. Lemma 3.4. If i is bivalent critical, then Υi contains a decision gadget. Proof. Let i be a bivalent critical index. In Figure 7, we present a procedure which goes through Υ i. The algorithm starts from the bivalent root of Υ i and terminates when a hook or a fork has been found. > S←S⊥ > while true do > p← 〈 choose the next correct process in a round robin fashion 〉 > m← 〈 choose the oldest undelivered message addressed to pin S(Ii)〉 > if 〈Shas a descendant S′in Υ i(possibly S=S′) such that, for some d,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
> S′·(p, m, d ) is a bivalent vertex of Υ i〉 > then S←S′·(p, m, d ) > else exit > Fig. 7. Locating a decision gadget We show that the algorithm indeed terminates. Suppose not. Then the algorithm locates an infinite fair path through the simulation tree, i.e., a path in which all correct processes get scheduled infinitely often and every message sent to a correct process is eventually consumed. Additionally, this fair path goes through bivalent states only. But no correct process can decide in a bivalent state S(Ii) (otherwise we would violate the Agreement property of consensus). As a result, we constructed a run of A in which no correct process ever decides — a contradiction. Thus, the algorithm in Figure 7 terminates. That is, there exists a bivalent vertex S, a correct process p, and a message m addressed to p in S(Ii) such that For all descendants S′ of S (including S′ = S) and all d, (1) S′ · (p, m, d ) is not a bivalent vertex of Υ i.In other words, any step of p consuming message m brings any descendant of S (including S itself) to either a 1-valent or a 0-valent state. Without loss of generality, assume that, for some d, S · (p, m, d ) is a 0-valent vertex of Υ i. Since S is bivalent, it must have a 1-valent descendant S′′ .24 · Freiling, Guerraoui, Kouznetsov If S′′ includes a step in which p consumes m, then we define S′ as the vertex of Υi such that, for some d′, S′ · (p, m, d ′) is a prefix of S′′ . If S′′ includes no step in which p consumes m, then we define S′ = S′′ . Since p is correct, for some
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
d′, S′ · (p, m, d ′) is a vertex of Υ i. In both cases, we obtain S′ such that for some d′, S′ · (p, m, d ′) is a 1-valent vertex of Υ i.Let the path from S to S′ go through the vertices σ0 = S, σ 1, . . . , σ m−1, σ m = S′.By transitivity of G, for all k ∈ { 0, 1, . . . , m }, σk · (p, m, d ′) is a vertex of Υ i. By statement 2, σk · (p, m, d ′) is either 0-valent or 1-valent vertex of Υ i. > σ0=S(bivalent) > Case 1 > (0-valent) (p, m, d )(0-valent) (1-valent) > σm=S′ > (1-valent) > Case 2 > (p′′ , m ′′ , d ′′ ) > σk−1 > σk > (p, m, d ′)(p, m, d ′)(p, m, d ′)(p, m, d ′) > S⊥ > Fig. 8. Locating a fork (Case 1) or a hook (Case 2) Let k ∈ { 0, . . . , m } be the lowest index such that ( p, m, d ′) brings σk to a 1-valent state. We know that such an index exists, since σm · (p, m, d ′) is 1-valent and all such resulting states are either 0-valent or 1-valent. Now we have the following two cases to consider: (1) k = 0, and (2) k > 0. Assume that k = 0, i.e., ( p, m, d ′) applied to S brings it to a 1-valent state. But we know that there is a step ( p, m, d ) that brings S to a 0-valent state (Case 1 in Figure 8). That is, a fork is located! If k > 0, we have the following
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
situation. Step ( p, m, d ′) brings σk−1 to a 0-valent state, and σk = σk−1 · (p′, m ′, d ′′ ) to a 1-valent state (Case 2 in Figure 8). But that is a hook! As a result, any bivalent infinite simulation tree has at least one decision gad-get. 3.2.9 The reduction algorithm. Now we are ready to complete the description of TD→ Ω. In the computation task (Figure 9), every process p periodically extracts the current leader from its simulation forest, so that eventually the correct processes agree on the same correct leader. The current leader is stored in variable Ω -output p.The Failure Detector Abstraction · 25 Initially: for i = 0 , 1, . . . , n : Υ ip ← empty graph Ω-output p ← p while true do { Build and tag the simulation forest induced by Gp } for i = 0 , 1, . . . , n do Υip ← simulation tree induced by Gp and Ii for every vertex S of Υ ip: if S has a descendant S′ such that p decides v in S′(Ii) then add tag v to S { Select a process from the tagged simulation forest } if there is a critical index then i ← the smallest critical index if i is univalent critical then Ω-output p ← pi if Υip has a decision gadget then Ω-output p ← the deciding process of the smallest decision gadget in Υ ip > Fig. 9. Extracting a correct leader: code for each process p Initially, p elects itself as a leader. Periodically, p updates its simulation forest Υp by incorporating more simulation stimuli from Gp. If the forest has a univalent critical index i, then p outputs pi as the current leader estimate.
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
If the forest has a bivalent critical index i and Υ ip contains a decision gadget, then p outputs the deciding process of the smallest decision gadget in Υ ip (the “smallest” can be well-defined, since the vertices of the simulation tree are countable). Eventually, the correct processes locate the same stable critical index i. Now we have two cases to consider: (i) i is univalent critical. By Lemma 3.2, pi is correct. (ii) i is bivalent critical. By Lemma 3.4, the limit simulation tree Υ i contains a decision gadget. Eventually, the correct processes locate the same decision gadget γ in Υ i and compute the deciding process q of γ. By Lemma 3.3, q is correct. Thus, eventually, the correct processes elect the same correct leader — Ω is emulated! 3.3 The weakest failure detector for a register In this section, we show that the quorum failure detector Σ is the weakest failure detector to implement atomic registers in all environments. Combined with earlier work on state machine replication [Lamport 1978; Schneider 1990], this implies that (Ω , Σ), the composition of Ω and Σ, is the weakest failure detector for solving consensus in all environments, i.e., for all assumptions on when and where failures might occur.. The result was first obtained by Delporte-Gallet et al. . An alternative 26 · Freiling, Guerraoui, Kouznetsov “CHT-like” proof, based on exchanging failure detector samples and using the sam-ples as stimuli for locally simulated runs, was later presented by Eisler et al. . We review here the proof of Eisler et al. , because it employs the simulation technique discussed in the previous section. 3.3.1 Read/write shared memory. A register is a shared object accessed through two operations: read and write . The write operation takes as an input parameter a
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
specific value to be stored in the register and returns a simple indication ok that the operation has been executed. The read operation takes no parameters and returns a value according to one of the following consistency criteria. A (single-writer, multi-reader) safe register ensures only that any read operation that does not overlap with any other operation returns the argument of the last write oper-ation. A (stronger) regular register ensures that any read operation returns either a concurrently written value, or the value written by the last write operation. The (strongest) atomic register ensures that any operation appears to be executed in-stantaneously between its invocation and reply time events. (Precise definitions are given by Herlihy and Wing [1990; Attiya and Welch .) The registers we consider are fault-tolerant : they ensure that, despite concurrent invocations and possible crashes of the processes, every correct process that invokes an operation eventually gets a reply (a value for the read and an ok indication for the write). The classical results [Vit´ anyi and Awerbuch 1986; Israeli and Li 1993] imply that if a failure detector D is sufficient to implement a safe one-writer one-reader register for any two processes, then D is sufficient to implement an atomic multi-writer multi-reader register. Thus, we do not need to specify here whether the register implemented using D is safe, regular or atomic: all these registers are computationally equivalent. 3.3.2 The sufficiency part. Recall that the quorum failure detector Σ outputs a set of processes at each process. Any two sets (output at any times and by any processes) intersect, and eventually every set consists of only correct processes. By a simple variation of the algorithm of Attiya et al. for implementing registers in a message-passing system with a majority of correct processes, we obtain an
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
algorithm that implements registers in any environment using Σ. Where the original algorithm uses waiting until a majority responds to ensure that a read operation returns the most recently written value, we can use the quorums provided by Σ to the same effect. 3.3.3 The reduction algorithm. Now we need to show that any failure detector that can be used to implement registers can be transformed into Σ. Let E be any environment. Let D be any failure detector that can be used to implement in E a set of atomic registers {Xp}p∈Π, where for every p ∈ Π, Xp can be written by p and read by all processes. We present an algorithm that, using D,implements Σ. To extract Σ, we assign a particular protocol, i.e., a sequence of operations on the implemented registers, to every process. In this protocol, denoted A, every process p first writes 1 in Xp, and then reads the registers {Xq }q∈Π (we assume that each Xq is initialized to 0). A run in which p is the only process that executes A, is The Failure Detector Abstraction · 27 > Initially: Σ-output p←Π{Σ-output pis the output of p’s module of Σ} > I←the initial configuration of A > while true do wait until padds a new failure detector sample uto its DAG Gp > repeat > let Gp(u) be the subgraph induced by the descendants of uin Gp > S ← set of all schedules of Acompatible with some path of Gp(u) and applicable to I > until there is a schedule S∈ S of a complete p-solo run of A > Σ-output p←set of all processes that take steps in the schedule S > Fig. 10. Extracting Σ: code for each process p called a p-solo run of A. A p-solo run
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
in which p completes A, is called a complete p-solo run of A.It is important to notice that in any run R of A in which two processes p and q both complete executing A, either p reads 1 in Xq , or q reads 1 in Xp. Intuitively, this implies that the sets of processes “involved” in the executions of A at p and q intersect, which gives us a hint of how to extract Σ from A and D.Again, the reduction algorithm consists of two tasks: the communication task and the computation task. The communication task, in which each process p samples its local module of D, exchanges the failure detector samples with the other processes, and assembles these samples in an ever-increasing directed acyclic graph Gp, which is organized exactly as in Section 3.2 (Figure 4). The computation task, in which p simulates runs of A and uses these runs to extract its current quorum (the output of its emulated module of Σ), is presented in Figure 10. To compute its current quorum, process p first waits until enough “fresh” (not previously appeared) failure detector samples are collected in Gp. Eventually, Gp includes a sufficiently long fresh path g such that there is a schedule S of a complete p-solo run of A, compatible with g. The set of processes that take steps in S constitute the current quorum of p stored in variable Σ -output p.The correctness of the reduction algorithm follows immediately from the following two observations: (1) Eventually, at every correct process p, Σ -output p contains only correct pro-cesses. Indeed, there is a time after which faulty processes do not produce fresh failure detector samples and thus do not participate in fresh schedules of A simulated by p.(2) For all p and q,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Σ -output p and Σ -output q always intersect. Indeed, assume, by contradiction, that there exist P, Q ⊂ Π such that P ∩Q = ∅,and, at some time t1, p computes Σ -output p = P and, at some time t2, q computes Σ -output q = Q.By the algorithm of Figure 10, A has a complete p-solo run Rp = 〈F, I, S p〉28 · Freiling, Guerraoui, Kouznetsov and a complete q-solo run Rq = 〈F, I, S q 〉 such that the sets of processes that participate in Sp and Sq are disjoint. But the two runs Rp and Rq can be composed in a single run R = 〈F, I, S 〉 that is indistinguishable from Rp to p, and indistinguishable from Rq to q.Hence, both p and q complete A in R. Since Rp is a p-solo run, and p cannot distinguish R and Rp, p reads 0 from register Xq in R. Respectively, q reads 0 from register Xp in R. But this cannot happen in any register implementation: at least one of the processes p and q must read 1 in the register of the other process! The contradiction implies that Σ -output p and Σ -output q always intersect. Thus, for all environments E, Σ is the weakest failure detector to implement atomic registers in E.3.3.4 Solving consensus in all environments. Once we determined the weakest failure detector to implement atomic registers, determining the weakest failure de-tector for solving consensus in all environments is straightforward. This failure detector is (Ω , Σ), the composition of Ω and Σ. Indeed, failure detector (Ω , Σ) can be used to solve consensus in all environments, by first implementing registers out of Σ, and then consensus out of registers and Ω [Lo and Hadzilacos 1994].
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
On the other hand, consensus can be used to implement atomic registers in any environment [Lamport 1978; Schneider 1990], and thus to extract Σ. Combined with the fact that Ω is necessary to solve consensus in any environment [Chandra et al. 1996] (see Section 3.2), this implies that (Ω , Σ) is necessary to solve consensus in any environment. 3.4 Solving Non-Blocking Atomic Commit In this section, we discuss determining the weakest failure detector for solving Non-Blocking Atomic Commit (NBAC) in all environments. This failure detector is (Ψ , FS ), the composition of Ψ, introduced by Delporte-Gallet et al. , and FS , the failure signal failure detector [Charron-Bost and Toueg 2001; Guerraoui 2002]. 3.4.1 Failure detector Ψ. Roughly speaking, Ψ behaves as follows: For an initial period of time the output of Ψ at each process is ⊥. Eventually, however, Ψ behaves either like the failure detector (Ω , Σ) at all processes, or, in case a failure previously occurred , it may instead behave like the failure detector FS by outputting red at all processes. The switch from ⊥ to (Ω , Σ) or FS need not occur simultaneously at all processes, but the same choice is made by all processes. Note that the switch from ⊥ to FS is allowable only if a failure previously occurred. Furthermore, if a failure does occur processes are not required to switch from ⊥ to FS ; they may still switch to (Ω , Σ). 3.4.2 Using (Ψ , FS ) to solve NBAC. The algorithm in Figure 11 uses (Ψ , FS )to solve NBAC in any environment E. The algorithm is very similar to that of Fig. 3. Each process p sends its vote to all processes and then waits until the votes of all processes are received
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
or FS detects a failure by outputting red . If the votes of all processes are received and are yes , then p sets the myproposal variable to The Failure Detector Abstraction · 29 > non-blocking atomic commit (v): {vis yes or no } > 1send vto all > 2wait until [(for each process qin Π, received q’s vote) or FS p=red ] > 3if the votes of all processes are received and are yes then > 4myproposal ←1 > 5else {some vote was no or there was a failure } > 6myproposal ←0 > 7wait until [Ψ p6=⊥] > 8if Ψp=red > 9then {henceforth Ψbehaves like FS } > 10 return abort > 11 else {henceforth Ψbehaves like (Ω ,Σ) } > 12 mydecision ←consPropose (v){use Ψto run (Ω ,Σ) -based consensus algorithm } > 13 if mydecision = 1 then > 14 return commit > 15 else 16 return abort > Fig. 11. Using (Ψ ,FS ) to solveNBAC: code for each process p 1. Otherwise, if some vote was no or a failure was detected by FS , then p sets the myproposal variable to 0. Then each process p waits until the output of Ψ becomes different from ⊥. At that time, either Ψ starts behaving like FS or it starts behaving like (Ω , Σ). If Ψ starts behaving like FS (Ψ can do so only if a failure previously occurred), p returns abort . The remaining case is that Ψ starts behaving like (Ω , Σ). It is shown in [Delporte-Gallet et al. 2003] that there is an algorithm that uses (Ω , Σ) to solve consensus in any environment (see also Sect. 3.3). Therefore, in this case, p proposes myproposal to that consensus algorithm and returns the value decided by that algorithm. If
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
1 is decided in the consensus algorithm, then p returns commit . If 0 is decided, then p returns abort .The Agreement property of NBAC follows from the Agreement property of con-sensus and the fact that the output of Ψ switches uniformly from ⊥ to (Ω , Σ) or FS at all processes. If there are no failures, then eventually p receives all the votes. If a failure occurs, then FS eventually outputs red . Hence, the wait statement in line 2 is non-blocking. The Termination property of consensus ensures that every correct process eventually decides. Assume that p decides commit . By Validity of consensus some process q pre-viously proposed 1. By the algorithm, q received the votes of all processes and all the votes were yes .Assume now that p decides abort . Thus, either Ψ p output red , i.e., a failure previously occurred, or the consensus algorithm (Ω , Σ) returned 0. By Validity of consensus some process q previously proposed 0. If some process q proposed 0, then either q received vote no from some process or a failure previously occurred and was detected by FS . In both cases, Validity of NBAC is ensured. 3.4.3 The weakest failure detector to solve NBAC. Intuitively, (Ψ , FS ) precisely captures the semantics of NBAC. Indeed, if all processes propose 1 the only reason for an NBAC algorithm not to decide commit is a failure of some process. So 30 · Freiling, Guerraoui, Kouznetsov repeatedly running the algorithm can be used for “anonymously” detecting failures, i.e., emulating FS . Further, if processes agree on the fact that a failure previously occurred, then it is safe for them to return abort (the FS part of failure detector Ψ). Otherwise, processes must be able to reach agreement using
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
there views of proposed values (the (Ω , Σ) part of failure detector Ψ). Let E be any environment. Let D be any failure detector that solves NBAC in E, and let A be any algorithm that solves NBAC in E using D.There is a straightforward reduction algorithm that transforms D into FS [Charron-Bost and Toueg 2001; Guerraoui 2002]. Initially, at every process, the reduction algorithm outputs green . Processes run a series of instances of the NBAC algo-rithm A using D proposing yes in every instance, as long as commit is decided in every instance. If abort is decided, then the reduction algorithm switches its output to red . Clearly, red can only be output if a failure previously occurred, and if a failure occurs, eventually red is permanently output at every correct process. Showing that D can be transformed into Ψ is based on a rather involved use of properties of NBAC and the technique of [Chandra et al. 1996], and we refer to [Delporte-Gallet et al. 2004] for the description of the corresponding reduction algorithm. 3.5 Summary Failure detectors are not only a helpful engineering abstraction but also allow to compare the synchrony requirements of problems in fault-tolerant computing. In this section we discussed the associated problem of the weakest failure detector and presented three examples of weakest failure detector proofs. 4. LIMITATIONS OF FAILURE DETECTORS The failure detector abstraction has many practical and theoretical virtues, but we do not want to close this survey without also investigating the limitations of this abstraction which have been frequent sources of misunderstandings and miscon-ceptions in fault-tolerant algorithms. We have grouped the discussion about the limitations around four basic questions which we discuss and put into context. 4.1 What is not a Failure Detector? The original work on failure detectors
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
[Chandra and Toueg 1996] defines a failure detector to be a mapping from a failure pattern F to some output range H. The failure pattern F specifies which processes fail at what time. So anything that can be defined as a function of failures can be formally called a failure detector. Not everything that looks like a failure detector can however be defined as a function of failures. Considering the crash failure model, Charron-Bost et al. observed that there exist problems that cannot be solved in asynchronous systems assuming even a perfect failure detector. For example, determining how many events a process executed before it crashed cannot be determined using a perfect failure detector. This is counterintuitive since in a fully synchronous system this can easily be detected if the failed process broadcasts a message with every event and an observer waits until a correctly calculated timeout has passed. G¨ artner and Pleisch managed to specify a device similar to a failure de-tector that allows to fully emulate a synchronous system. This device works like a The Failure Detector Abstraction · 31 perfect failure detector, only that — upon suspecting a process — the device re-turns a dump of the state in which that process crashed. The precise formulation of this device is not a function of failures anymore, but rather a function of the process state and the failures in the system. G¨ artner and Pleisch proved that such a device allows to embed crash events perfectly into the causal history of a compu-tation. So any problem which can be defined as the result of the causal structure of a computation can be computed. As another result, they showed that the same can be achieved with a perfect failure detector if the communication channels are synchronous
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
(i.e. having a bound δ but not having a bound ∆, see Section 2.1.5). So at least a perfect failure detector can be regarded as an abstraction of process synchrony, not of channel synchrony. 4.2 Do Failure Detectors make sense outside of the crash model? The “classic” failure detectors have been crash failure detectors, i.e., they were tailored to the crash failure model. There are many other failure models in the literature. Among those that refer to the incorrect behavior of processes are fail-stop [Schlichting and Schneider 1983], crash-recovery [Oliveira et al. 1997; Aguilera et al. 1998; Hurfin et al. 1998], send/receive omission [Hadzilacos 1984; Hadzilacos and Toueg 1994] and Byzantine [Lamport et al. 1982]. The fail-stop failure model is just like the crash failure model, except that the crash of a process is easily detectable by other processes. In the send/receive omission failure model a process sends or receives only a subset of messages it was supposed to send or receive. Finally, the Byzantine failure model allows arbitrary behavior of a faulty process. In general, the type of failure detector which is necessary to solve a problem depends on the problem itself (e.g., consensus) and the failure model assumed in the network (e.g., crash). Usually, the failure model indicates what information the failure detector offers and the problem dictates how the failure detector should present this information (i.e., the failure detector properties). For example, consider the crash-recovery failure model where processes can crash and later start execution again from a predefined point in their program. Since the failure model offers a new type of behavior, adequate failure detectors should be able to convey information about this behavior. Consequently, the failure detectors used in the context of solving consensus in the crash-recovery model [Aguilera et al. 2000a] output a vector
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
of unbounded counters hinting on how often a process has been suspected. Considering the consensus problem, failure detector specifications have been ex-tended to environments where the network may partition [Guerraoui and Schiper 1996; Aguilera et al. 1999] and processes may experience send and receive omissions [Dolev et al. 1997; Delporte-Gallet et al. 2005]. Lossy links are a usual assumption in work on consensus in the crash-recovery failure model [Oliveira et al. 1997; Aguil-era et al. 1998; Hurfin et al. 1998]. In this model, questions of to what extent stable storage is necessary are also important. Lo and Hadzilacos [Lo and Hadzilacos 1994] study failure detection and consensus in a shared memory setting. The model of finite transient failures which is characteristic to the area of self-stabilization [Di-jkstra 1974; Dolev 2000] has also been studied in the context of failure detectors [Beauquier and Kekkonen-Moneta 1997; Hutle and Widder 2005]. Fixing the crash model, other problems than consensus have been studied adapt-ing the failure detection approach. Sabel and Marzullo consider the election 32 · Freiling, Guerraoui, Kouznetsov problem (see also Larrea et al. ) while Matsui et al. investigate eventual leader election of k processes (which they call k-consensus ). Issues of group commu-nication have also been considered (e.g., atomic multicast [Guerraoui and Schiper 1997] and generic broadcast [Pedone and Schiper 1999; Aguilera et al. 2000]). Pred-icate detection in faulty environments is investigated by Garg and Mitchell [1998a], G¨ artner and Kloppenburg , and G¨ artner and Pleisch . The failure detector abstraction cannot easily be adapted to Byzantine failures since it is not possible to derive a clean failure detector interface which is orthogonal to the specification of the algorithm using it. This is because the notion of a failure is not only related to timing/synchrony but also to
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
application level messages. The closest we can get are so-called “muteness” detectors [Doudou et al. 1999; Doudou et al. 2002]. But this approach usually assumes that processes send certain messages continuously and relay messages to all others if they receive them for the first time. Kihlstrom et al. distinguishes between detectable and undetectable Byzantine failures. Non-detectable failures are either unobservable (a Byzantine process spontaneously changes his input value) or undiagnosable (they cannot be tagged to a specific process, e.g. if a process claims that some other process sent him something). Byzantine failure detectors can only report detectable faults, which can be further classified into commisson and omission faults, the former being in the value domain and the latter in the time domain. The omission fault detectors of Kihlstrom et al. correspond to the muteness failure detectors of Doudou et al. . 4.3 Can Randomization be used to implement Failure Detectors? In 1983, Ben-Or presented an algorithm which solves consensus in the com-pletely asynchronous model (i.e., without failure detectors) by using randomization .In the algorithm, processes repeatedly flip coins to reach a majority of proposed values, upon which termination is reached. In doing this and because of the prop-erties of the random coin, it can be shown that the probability of non-terminating runs diminishes to zero and, hence, termination can be achieved with probability one. So since both randomization and failure detection can be seperately used to solve consensus it is legitimate to ask: Can failure detectors be implemented using randomization? Aguilera and Toueg presented an algorithm that uses randomization and unreliable failure detection to solve consensus. But their approach does not use randomization to implement failure detectors, rather randomization is used to guar-antee termination in case the failure detectors never become reliable. V¨ olzer studied
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
the relationship between fairness and randomization. He showed that to solve crash-tolerant consensus it is sufficient to postulate a certain kind of fairness called hyperfairness . Briefly spoken, hyperfairness looks at situa-tions in which certain resources are needed (e.g., for a process to terminate) but which can be independently made available and withdrawn to a process. Hyperfair-ness means that eventually these resources will be “synchronized” and available to that process. This special type of fairness can be implemented using randomization and partial synchrony. The Failure Detector Abstraction · 33 4.4 Can Failure Detectors be used to Reason about Real-Time? Failure detectors offer an asynchronous interface for timing information. It is nev-ertheless sometimes helpful to figure out what kind of synchrony in terms of explicit time failure detectors do offer. Strong failure detectors have strong completeness and weak accuracy. This means that every crash is eventually detected but processes can make mistakes about other processes except a single same one . Making mistakes means to “time out too soon”. Thus, implementing a strong failure detector makes it necessary to have communication and processing speed bounds regarding one “central” process. Note that this feature is asymmetric: The bounds must hold for communication coming from the central process, not for communication running towards it. Eventually Strong failure detectors have strong completeness and eventually weak accuracy. The situation here is that processes can now make mistakes about all processes, but must eventually stop making mistakes regarding a single same pro-cess. Systems which offer an eventually strong failure detector must ensure that eventually communication and processing speed bounds hold regarding one “cen-tral” process but only in direction from this process to the other processes. This was formalized into the concept of an (eventual) source [Aguilera et al. 2001; 2003], a process whose outgoing channels are
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
(eventually) timely. As discussed above, perfect failure detectors allow building a system which is very close (but not equivalent) to a fully synchronous one [Charron-Bost et al. 2000]. It has still been argued that the use of failure detectors also offers the potential of building real-time applications by using the approach of late binding [Hermant and Le Lann 2002]. In this approach, a real-time problem is turned into a “time-free” problem, e.g., by basing timeliness requirements on certain activation conditions using time-free extensions to the asynchronous model like failure detectors. In this context, an asynchronous solution can be devised. Then the solution is bound to an as weakly synchronous system model as possible (e.g., one of partial synchrony) and the real-time instants of the activation conditions are computed from the guar-antees of the underlying model. Since the application satisfies its safety and liveness properties even if the underlying network transiently violates its timeliness guaran-tees, this approach allows to build real-time applications with higher assumption coverage than if real-time were considered from the beginning of the design process. Along this line of research, the issue of fast failure detectors has been investigated, i.e., failure detectors which detect failures in a time which is orders of magnitude less than a round trip delay [Aguilera et al. 2002]. 5. SUMMARY Take the time-free system model which is usually used when reasoning about fault-intolerant distributed algorithms, add the concept of unreliable failure detectors, and you get a system model which can be used to reason about fault-tolerant distributed algorithms. The failure detector abstraction has many virtues as an engineering tool and as a computability benchmark, but also has some limitations in expressiveness. 34 · Freiling, Guerraoui, Kouznetsov REFERENCES Aguilera , Delporte-Gallet , Fauconnier , and Toueg . 2001. Stable leader election. In DISC: International
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Symposium on Distributed Computing . LNCS. Aguilera , Delporte-Gallet , Fauconnier , and Toueg . 2003. On implementing omega with weak reliability and synchrony assumptions. In PODC: 22th ACM SIGACT-SIGOPS Sympo-sium on Principles of Distributed Computing . Aguilera, M. and Toueg, S. 1998. Failure detection and randomization: A hybrid approach to solve consensus. SIAM Journal on Computing 28 . Aguilera, M. K. , Chen, W. , and Toueg, S. 1998. Failure detection and consensus in the crash-recovery model. In Proceedings of the 12th International Symposium on Distributed Computing (DISC) . 231–245. Aguilera, M. K. , Chen, W. , and Toueg, S. 1999. Using the heartbeat failure detector for qui-escent reliable communication and consensus in partitionable networks. Theoretical Computer Science 220, 1 (June), 3–30. Aguilera, M. K. , Chen, W. , and Toueg, S. 2000a. Failure detection and consensus in the crash recovery model. Distributed Computing 13, 2 (Apr.), 99–125. Aguilera, M. K. , Chen, W. , and Toueg, S. 2000b. On quiescent reliable communication. SIAM Journal on Computing 29, 6 (Dec.), 2040–2073. Aguilera, M. K. , Delporte-Gallet, C. , Fauconnier, H. , and Toueg, S. 2000. Thrifty generic broadcast. In Proceedings of the 14th International Symposium on Distributed Computing (DISC) . Number 1914 in Lecture Notes in Computer Science. Springer-Verlag, Toledo, Spain, 268–282. Aguilera, M. K. , Le Lann, G. , and Toueg, S. 2002. On the impact of fast failure detectors on real-time fault-tolerant systems. In Proceedings of the 16th International Symposium on Distributed Computing (DISC’02) . 354–370. Arora, A. and Kulkarni, S. S. 1998. Detectors and correctors: A theory of fault-tolerance com-ponents. In Proceedings of the 18th IEEE International Conference on Distributed Computing Systems (ICDCS98) . Attiya, H. , Bar-Noy, A. , and Dolev, D. 1995. Sharing memory robustly in message-passing systems. Journal of the ACM 42, 1,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
124–142. Attiya, H. and Welch, J. L. 2004. Distributed Computing: Fundamentals, Simulations and Advanced Topics (2nd edition) . Wiley. Barborak, M. , Dahbura, A. , and Malek, M. 1993. The consensus problem in fault-tolerant computing. ACM Computing Surveys 25, 2 (June), 171–220. Beauquier, J. and Kekkonen-Moneta, S. 1997. Fault-tolerance and self-stabilization: impos-sibility results and solutions using self-stabilizing failure detectors. International Journal of System Science 28, 11, 1177–1187. Ben-Or, M. 1983. Another advantage of free choice: Completely asynchronous agreement proto-cols. In Proc. Second Ann. ACM Symp. on Principles of Distributed Computing . 27–30. Bernstein, P. , Hadzilacos, V. , and Goodman, N. 1987. Concurrency Control and Recovery in Database Systems . Addison-Wesley, Reading, MA. Brasileiro, F. , Greve, F. , Most´ efaoui, A. , and Raynal, M. 2000. Consensus in one commu-nication step. Tech. Rep. PI-1321, IRISA, Rennes, France. Chandra, T. D. , Hadzilacos, V. , and Toueg, S. 1996. The weakest failure detector for solving consensus. Journal of the ACM 43, 4 (July), 685–722. Chandra, T. D. and Toueg, S. 1996. Unreliable failure detectors for reliable distributed systems. Journal of the ACM 43, 2 (Mar.), 225–267. Chandy, K. M. and Misra, J. 1988. Parallel Program Design: A Foundation . Addison-Wesley, Reading, MA, Reading, Mass. Charron-Bost, B. , Guerraoui, R. , and Schiper, A. 2000. Synchronous system and perfect failure detector: Solvability and efficiency issues. In International Conference on Dependable Systems and Networks (IEEE Computer Society) . Charron-Bost, B. and Toueg, S. 2001. Unpublished notes. The Failure Detector Abstraction · 35 Chen, W. , Toueg, S. , and Aguilera, M. K. 2000. On the quality of service of failure detectors. In Proceedings of the International Conference on Dependable Systems and Networks (DSN 2000) . IEEE Computer Society Press, New York. Chu, F. 1998. Reducing Ω to 3W . Information Processing Letters
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
67 , 289–293. Cristian, F. and Fetzer, C. 1999. The timed asynchronous distributed system model. IEEE Transactions on Parallel and Distributed Systems 10, 6 (June). Delporte-Gallet, C. , Fauconnier, G. , and Freiling, F. C. 2005. Revisiting failure detection and consensus in omission failure environments. In Theoretical Aspects of Computing - ICTAC 2005, Second International Colloquium, Hanoi, Vietnam , D. V. Hung and M. Wirsing, Eds. Number 3722 in Lecture Notes in Computer Science. Springer-Verlag, 394–408. Delporte-Gallet, C. , Fauconnier, H. , and Guerraoui, R. 2003. Shared mem-ory vs message passing. Tech. Rep. IC/2003/77, EPFL. December. Available at Delporte-Gallet, C. , Fauconnier, H. , Guerraoui, R. , Hadzilacos, V. , Kouznetsov, P. , and Toueg, S. 2004. The weakest failure detectors to solve certain fundamental problems in distributed computing. In PODC . 338–346. Dijkstra, E. W. 1974. Self stabilizing systems in spite of distributed control. Communications of the ACM 17, 11, 643–644. Dijkstra, E. W. , Feijen, W. H. J. , and van Gasteren, A. J. M. 1983. Derivation of a termi-nation detection algorithm for distributed computations. Information Processing Letters 16, 5(June), 217–219. Dolev, D. , Friedmann, R. , Keidar, I. , and Malkhi, D. 1997. Failure detectors in omission failure environments. In Proceedings of the 16th Annual ACM Symposium on Principles of Distributed Computing (PODC97) . Dolev, S. 2000. Self-Stabilization . MIT Press. Doudou, A. , Garbinato, B. , and Guerraoui, R. 2002. Encapsulating failure detection: from crash to Byzantine failures. In Proceedings of the Int. Conference on Reliable Software Tech-nologies . Vienna. Doudou, A. , Garbinato, B. , Guerraoui, R. , and Schiper, A. 1999. Muteness failure detectors: specification and implementation. In Proc. 3rd European Dependable Computing Conference .Number 1667 in Lecture Notes in Computer Science. Springer-Verlag, Prague, Czech Republic, 71–87. Dwork, C. , Lynch, N. ,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
and Stockmeyer, L. 1988. Consensus in the presence of partial syn-chrony. Journal of the ACM 35, 2 (Apr.), 288–323. Eisler, J. , Hadzilacos, V. , and Toueg, S. 2004. The quorum failure detector and its relation to consensus and registers. Unpublished note. Fischer, M. J. , Lynch, N. A. , and Paterson, M. S. 1985. Impossibility of distributed consensus with one faulty process. Journal of the ACM 32, 2 (Apr.), 374–382. Garg, V. K. and Mitchell, J. R. 1998a. Distributed predicate detection in a faulty environment. In Proceedings of the 18th IEEE International Conference on Distributed Computing Systems (ICDCS98) . Garg, V. K. and Mitchell, J. R. 1998b. Implementable failure detectors in asynchronous sys-tems. In Proc. 18th Conference on Foundations of Software Technology and Theoretical Com-puter Science . Number 1530 in Lecture Notes in Computer Science. Springer-Verlag, Chennai, India. G¨ artner, F. C. and Kloppenburg, S. 2000. Consistent detection of global predicates under a weak fault assumption. In Proceedings of the 19th IEEE Symposium on Reliable Distributed Systems (SRDS2000) . IEEE Computer Society Press, N¨ urnberg, Germany, 94–103. G¨ artner, F. C. and Pleisch, S. 2001. (Im)Possibilities of predicate detection in crash-affected systems. In Proceedings of the 5th Workshop on Self-Stabilizing Systems (WSS2001) . Number 2194 in Lecture Notes in Computer Science. Springer-Verlag, Lisbon, Portugal, 98–113. G¨ artner, F. C. and Pleisch, S. 2002. Failure detection sequencers: Necessary and sufficient information about failures to solve predicate detection. In Proceedings of the 16th International 36 · Freiling, Guerraoui, Kouznetsov Symposium on DIStributed Computing (DISC 2002) , D. Malkhi, Ed. Number 2508 in Lecture Notes in Computer Science. Springer-Verlag, Toulouse, France, 280–294. Guerraoui, R. 2000. Indulgent algorithms. In Proceedings of the 19th Annual ACM Symposium on Principles of Distributed Computing (PODC-00) . ACM Press, NY, 289–298. Guerraoui, R. 2002. Non-blocking atomic commitment
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
in asynchronous systems with failure detectors. Distributed Computing 15, 1, 17–25. Guerraoui, R. and Schiper, A. 1996. “Gamma-accurate” failure detectors. In Distributed Algorithms, 10th International Workshop, WDAG ’96 , ¨O. Babaoglu and K. Marzullo, Eds. Lecture Notes in Computer Science, vol. 1151. Springer-Verlag, Bologna, Italy, 269–286. Guerraoui, R. and Schiper, A. 1997. Genuine atomic multicast. In Proceedings of the 11th International Workshop on Distributed Algorithms (WDAG97) . Number 1320 in Lecture Notes in Computer Science. Springer-Verlag, 141–154. Hadzilacos, V. 1984. Issues of fault tolerance in concurrent computations. Ph.D. thesis, Harvard University. also published as Technical Report TR11-84. Hadzilacos, V. and Toueg, S. 1994. A modular approach to fault-tolerant broadcasts and related problems. Tech. Rep. TR94-1425, Cornell University, Computer Science Department. May. Herlihy, M. and Wing, J. M. 1990. Linearizability: a correctness condition for concurrent objects. ACM Transactions on Programming Languages and Systems 12, 3 (June), 463–492. Hermant, J. and Le Lann, G. 2002. Fast asynchronous uniform consensus in real-time dis-tributed systems. IEEE Transactions on Computers 51, 8 (Aug.), 931–944. Hurfin, M. , Most´ efaoui, A. , and Raynal, M. 1998. Consensus in asynchronous systems where processes can crash and recover. In Proceedings of the 17th IEEE Symposium on Reliable Distributed Systems (SRDS’98) . IEEE Computer Society Press, West Lafayette, Indiana, 280– 286. Hurfin, M. and Raynal, M. 1999. A simple and fast asynchronous consensus protocol based on a weak failure detector. Distributed Computing 12, 4, 209–223. Hutle, M. and Widder, J. 2005. On the possibility and the impossibility of message-driven self-stabilizing failure detection. In Self-Stabilizing Systems, 7th International Symposium, SSS 2005, Barcelona, Spain , T. Herman and S. Tixeuil, Eds. Lecture Notes in Computer Science, vol. 3764. Springer-Verlag, 153–170. Israeli, A. and Li, M. 1993. Bounded time-stamps. Distributed Computing 6, 4 (July), 205–209. Jean-Franc ¸ois Hermant and Josef Widder, title
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
= Implementing Reliable Distributed Real-Time Systems with the Theta-Model, O. . . O. . . b. . I. O. . . y. . . O. . . O. . . O. . . O. . . O. . . m. . d. O. . . O. . . O. . . O. . . Kihlstrom, K. P. , Moser, L. E. , and Melliar-Smith, P. M. 2003. Byzantine fault detectors for solving consensus. The Computer Journal 46, 1. Lamport, L. 1978. Time, clocks and the ordering of events in a distributed system. Communi-cations of the ACM 21, 7 (July), 558–565. Lamport, L. , Shostak, R. , and Pease, M. 1982. The Byzantine generals problem. ACM Trans-actions on Programming Languages and Systems 4, 3 (July), 382–401. Larrea, M. , Fern´ andez, A. , and Ar´ valo, S. 2000. Eventually consistent failure detectors. Tech. rep., Universidad P´ ublica de Navarra, Spain. Apr. Presented as a brief announcement at DISC2000. Lo, W.-K. and Hadzilacos, V. 1994. Using failure detectors to solve consensus in asynchronous shared-memory systems (extended abstract). In Proceedings of the 8th International Workshop on Distributed Algorithms (WDAG94) , G. Tel and P. M. B. Vit´ anyi, Eds. Lecture Notes in Computer Science, vol. 857. Springer-Verlag, Terschelling, The Netherlands, 280–295. Long, D. D. E. , Carroll, J. L. , and Park, C. J. 1991. A study of the reliability of Internet sites. In Proceedings of the 10th IEEE Symposium on Reliable Distributed Systems (SRDS91) .177–186. Matsui, H. , Inoue, M. , Masuzawa, T. , and Fujiwara, H. 2000. Fault-tolerant and self-stabilizing protocols using an unreliable failure detector. IEICE Transactions E83-D, 10 (Oct.), 1831–1840. The Failure Detector Abstraction · 37 Oliveira, R. , Guerraoui, R. , and Schiper, A. 1997. Consensus in the crash-recover model. Tech. Rep. TR-97/239, EPFL – D´ epartment d’Informatique,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Lausanne, Switzerland. Aug. Paxson, V. and Adams, A. 2002. Experiences with NIMI. In Proceedings of the 2002 Symposium on Applications and the Internet . Pedone, F. and Schiper, A. 1999. Generic broadcast. In Proceedings of the 13th International Symposium on Distributed Computing (DISC’99) . Powell, D. 1992. Failure mode assumptions and assumption coverage. In Proceedings of the 22nd Annual International Symposium on Fault-Tolerant Computing (FTCS ’92) , D. K. Pradhan, Ed. IEEE Computer Society Press, Boston, MA, 386–395. Sabel, L. S. and Marzullo, K. 1995. Election vs. consensus in asynchronous systems. Tech. Rep. TR95-1488, Cornell University, Computer Science Department. Feb. Schiper, A. 1997a. Early consensus in an asynchronous system with a weak failure detector. Distributed Computing 10, 3, 149–157. Schiper, A. 1997b. Erratum: Early consensus in an asynchronous system with a weak failure detector. Distributed Computing 10 , 198. Schlichting, R. D. and Schneider, F. B. 1983. Fail stop processors: An approach to designing fault-tolerant computing systems. ACM Transactions on Computer Systems 1, 3 (Aug.), 222– 238. Schneider, F. B. 1990. Implementing fault-tolerant services using the state machine approach: A tutorial. ACM Computing Surveys 22, 4 (Dec.), 299–319. Schneider, F. B. 1993. What good are models and what models are good? In Distributed Systems , Second ed., S. Mullender, Ed. Addison-Wesley, Reading, MA, Chapter 2, 17–26. Sergent, N. , D´ efago, X. , and Schiper, A. 1999. Failure detectors: implementation issues and impact on consensus performance. Tech. Rep. SSC/1999/019, ´Ecole Polytechnique F´ ed´ erale de Lausanne, Switzerland. Turek, J. and Shasha, D. 1992. The many faces of consensus in distributed systems. IEEE Computer 25, 6 (June), 8–17. Vit´ anyi, P. and Awerbuch, B. 1986. Atomic shared register access by asynchronous hardware. In Proceedings of the 27th Symposium on Foundations of Computer Science . 233–246. V¨ olzer, H. 2005. On conspiracies
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
and hyperfairness in distributed computing. In Proceedings of the 19th International Symposium on Distributed Computing, DISC 2005 . Number 3724 in Lecture Notes in Computer Science. Springer-Verlag, 33–47.
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Title: URL Source: Markdown Content: # Rachid Guerraoui, Lu´ ıs Rodrigues # Introduction to Distributed Algorithms # (Preliminary Draft) ## November 22, 2004 # Springer-Verlag ## Berlin Heidelberg NewYork London Paris Tokyo Hong Kong Barcelona Budapest To whom it might concern. *DRAFT* V (22/11/2004) Preface This manuscript aims at offering an introductory description of distributed programming abstractions and of the algorithms that are used to implement them in different distributed environments. The reader is provided with an insight on important problems in distributed computing, knowledge about the main algorithmic techniques that can be used to solve these problems, and examples of how to apply these techniques when building distributed applications. ## Content In modern computing, a program usually executes on several processes: in this context, a process is an abstraction that may represent a computer, a processor within a computer, or simply a specific thread of execution within a processor. The fundamental problem in devising such distributed programs usually consists in having the processes cooperate on some common task. Of course, traditional centralized algorithmic issues, on each process individually, still need to be dealt with. The added difficulty here is about achieving a robust form of cooperation, despite failures or disconnections of some of the processes, inherent to most distributed environments. Had no notion of cooperation been required, a distributed program would simply consist of a set of detached centralized programs, each running on a specific process, and little benefit could be obtained from the availability of several machines in a distributed environment. It was the need for cooperation that revealed many of the fascinating problems addressed by this manuscript, problems that would have otherwise remained undiscovered. The manuscript, not only exposes the reader to these problems but also presents ways to solve them in different contexts. Not surprisingly,
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
distributed programming can be significantly simplified if the difficulty of robust cooperation is encapsulated within specific abstrac-tions . By encapsulating all the tricky algorithmic issues, such distributed programming abstractions bridge the gap between network communication layers, usually frugal in terms of reliability guarantees, and distributed ap-plication layers, usually demanding in terms of reliability. Preface Preface The manuscript presents various distributed programming abstractions and describes algorithms that implement these abstractions. In a sense, we give the distributed application programmer a library of abstraction interface specifications, and the distributed system builder a library of algorithms that implement the specifications. A significant amount of the preparation time of this manuscript was de-voted to preparing the exercises and working out their solutions. We strongly encourage the reader to work out the exercises. We believe that no reasonable understanding can be achieved in a passive way. This is especially true in the field of distributed computing where the underlying anthropomorphism may provide fast but wrong intuitions. Many exercises are rather easy and can be discussed within an undergraduate teaching classroom. Some exercises are more difficult and need more time. These can be given as homeworks. The manuscript comes with a companion set of running examples imple-mented in the Java programming language, using the Appia protocol com-position framework. These examples can be used by students to get a better understanding of the implementation details not covered in the high-level description of the algorithms. Instructors can use these protocol layers as a basis for practical exercises, by suggesting students to perform optimizations on the code provided, to implement variations of the algorithms for different system models, or to design applications that make use of these abstractions. ## Presentation The manuscript is written in a self-contained manner. This has been made possible because the field of distributed algorithms
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
has reached a certain level of maturity where details, for instance about the network and various kinds of failures, can be abstracted away when reasoning about the distributed algorithms. Elementary notions of algorithms, first order logics, program-ming languages, networking, and operating systems might be helpful, but we believe that most of our abstraction specifications and algorithms can be understood with minimal knowledge about these notions. The manuscript follows an incremental approach and was primarily built as a textbook for teaching at the undergraduate or basic graduate level. It in-troduces basic elements of distributed computing in an intuitive manner and builds sophisticated distributed programming abstractions on top of more primitive ones. Whenever we devise algorithms to implement a given ab-straction, we consider a simple distributed system model first, and then we revisit the algorithms in more challenging models. In other words, we first de-vise algorithms by making strong simplifying assumptions on the distributed environment and then we discuss how to weaken those assumptions. We have tried to balance intuition and presentation simplicity, on one hand, with rigour, on the other hand. Sometimes rigour was impacted, and this might not have been always on purpose. The focus here is rather on *DRAFT* VIII (22/11/2004) Preface Preface abstraction specifications and algorithms, not on calculability and complexity. Indeed, there is no theorem in this manuscript. Correctness arguments are given with the aim of better understanding the algorithms: they are not formal correctness proofs per se. In fact, we tried to avoid Greek letters and mathematical notations: references are given to papers with more formal treatment of some of the material presented here. ## Organization • In Chapter 1 we motivate the need for distributed programming abstrac-tions by discussing various applications that typically make use of such abstractions. The chapter also presents the programming notations
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
used in the manuscript to describe specifications and algorithms. • In Chapter 2 we present different kinds of assumptions that we will be mak-ing about the underlying distributed environment, i.e., we present different distributed system models. Basically, we describe the basic abstractions on which more sophisticated ones are built. These include process and commu-nication link abstractions. This chapter might be considered as a reference throughout other chapters. The rest of the chapters are each devoted to one family of related abstrac-tions, and to various algorithms implementing them. • In Chapter 3 we introduce specific distributed programming abstractions: those related to the reliable delivery of messages that are broadcast to a group of processes. We cover here issues such as how to make sure that a message delivered by one process is delivered by all, despite the crash of the original sender process. • In Chapter 4 we discuss shared memory abstractions which encapsulate simple forms of distributed storage objects with read-write semantics, e.g., files and register abstractions. We cover here issues like how to ensure that a value written (stored) within a set of processes is eventually read (retrieved) despite the crash of some of the processes. • In Chapter 5 we address the consensus abstraction through which a set of processes can decide on a common value, based on values, each process ini-tially proposed, despite the crash of some of the processes. This abstraction is key in building abstractions described in subsequent chapters. • In Chapter 6 we consider ordering abstractions. In particular, we discuss the causal ordering of messages that are broadcast in the system, as well as a how consensus can be used to ensure totally ordered delivery of mes-sages. The resulting total order abstraction makes it easy to implement so-phisticated forms of shared distributed objects, beyond
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
read-write shared memory objects. *DRAFT* IX (22/11/2004) Preface Preface • In Chapter 7 we gather what we call coordination abstractions. These in-clude leader election, terminating reliable broadcast, non-blocking atomic commit and group membership. The distributed algorithms we will study differ naturally according to the actual abstraction they aim at implementing, but also according to the assumptions on the underlying distributed environment (we will also say dis-tributed system model), i.e., on the initial abstractions they take for granted. Aspects such as the reliability of the links, the degree of synchrony of the system, whether a deterministic or a randomized (probabilistic) solution is sought, have a fundamental impact on how the algorithm is designed. To give the reader an insight of how these parameters affect the algorithm design, the manuscript includes several classes of algorithmic solutions to implement the same distributed programming abstractions for various distributed system models. Covering all chapters, with their associated exercises, constitutes a full course in the field. Focusing for each chapter on the specifications of the ab-stractions and their underlying algorithms in their simplest form (i.e., for the simplest model of computation considered in the manuscript), would consti-tute a shorter, more elementary course. This can provide a nice companion to a more practically oriented course possibly based on our protocol framework. ## References We have been exploring the world of distributed programming abstractions for more than a decade now. During this period, we were influenced by many researchers in the field of distributed computing. A special mention to Leslie Lamport and Nancy Lynch for having posed fascinating problems in dis-tributed computing, and to the Cornell-Toronto school , including Ken Bir-man, Tushar Chandra, Vassos Hadzilacos, Robert van Renessee, Fred Schnei-der, and Sam Toueg, for their seminal work on various forms of distributed programming abstractions. Many other researchers have
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
directly or indirectly inspired the material of this manuscript. We did our best to reference their work throughout the text. Most chapters end with a historical note. This intends to provide hints for further readings, to trace the history of the concepts presented in the chapters, as well as to give credits to those who invented and worked out the concepts. At the end of the manuscript, we reference other manuscripts for further readings on other aspects of distributed computing. ## Acknowledgements We would like to express our gratitude to our undergraduate and graduate students from the Swiss Federal Institute of Technology in Lausanne (EPFL) *DRAFT* X (22/11/2004) Preface Preface and the University of Lisboa (UL), for serving as reviewers of preliminary drafts of this manuscript. Indeed they had no choice and needed to prepare their exams anyway. But they were indulgent toward the bugs and typos that could be found in earlier versions of the manuscript as well as associated slides, and they did provide us with useful feedback. Partha Dutta, Corine Hari, Ron Levy, Petr Kouznetsov and Bastian Pochon, graduate students at the Distributed Programming Laboratory of the Swiss Federal Institute of Technology in Lausanne (EPFL) at the time of writing this manuscript, as well as Filipe Ara´ ujo, and Hugo Miranda, gradu-ate students at the Distributed Algorithms and Network Protocol (DIALNP) group at the Departamento de Informtica da Faculdade de Cincias da Uni-versidade de Lisboa (UL), at the same period, suggested many improvements to the algorithms presented in the manuscript. Several of the implementa-tion for the “hands-on” part ofthe book were developed by or with the help of several DIALNP team members and students, including Nuno Carvalho, Maria Jo˜ ao Monteiro, Alexandre Pinto, and Lu´ ıs Sardinha. Finally, we would like to thank all several of our
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
colleagues who were kind enough to read and comment earlier drafts of this book. These include Lorenzo Alvisi, Roberto Baldoni, Carole Delporte, Hugues Fauconnier, Pas-cal Felber, Felix Gaertner, Anne-Marie Kermarrec, Fernando Pedone, Michel Raynal, and Marten Van Steen. Rachid Guerraoui and Lu´ ıs Rodrigues *DRAFT* XI (22/11/2004) Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Distributed Programming Abstractions . . . . . . . . . . . . . . . . . . . . 31.2.1 Inherent Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2.2 Distribution as an Artifact . . . . . . . . . . . . . . . . . . . . . . . . 61.3 The End-to-end Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.4 Software Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
81.4.1 Composition Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.4.2 Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.3 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.4 Classes of Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Print Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Bounded Print Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Composing Modules . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . 19 2. Basic Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.1 Distributed Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.1.1 Processes and Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.1.2 Automata and Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.1.3 Liveness and Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 2.2 Abstracting Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.2.1 Process Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.2.2 Lies and Omissions . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . 28 2.2.3 Crashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.4 Recoveries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.3 Abstracting Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.3.1 Link Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 2.3.2 Fair-loss Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.3.3 Stubborn Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.3.4 Perfect Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 2.3.5 Processes and Links . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . . . . . 37 2.4 Timing Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.4.1 Asynchronous System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Contents Contents 2.4.2 Synchronous System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.4.3 Partial Synchrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 2.5 Abstracting Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 2.5.1 Failure Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 2.5.2 Perfect Failure Detection . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.5.3 Eventually Perfect Failure Detection . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. 45 2.5.4 Eventual Leader Election . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.6 Distributed System Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.6.1 Combining Abstractions . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 2.6.2 Measuring Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Sendable Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Message and Extended Message . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Fair Loss Point to Point Links . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Perfect Point to Point Links . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . . . . . 55 Perfect Failure Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 3. Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . 61 3.1.1 Client-Server Computing . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.1.2 Multi-Participant Systems . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.2 Best-Effort Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.2.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.2.2 Fail-Silent Algorithm: Basic Broadcast . . . . . . . . . . . . . . 63 3.3 Regular Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 3.3.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 3.3.2 Fail-Stop Algorithm: Lazy Reliable Broadcast . . . . . . . . 65 3.3.3 Fail-Silent Algorithm: Eager Reliable Broadcast . . . . . . 67 3.4 Uniform Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
3.4.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3.4.2 Fail-Stop Algorithm: All-Ack URB . . . . . . . . . . . . . . . . . 69 3.4.3 Fail-Silent Algorithm: Majority-Ack URB . . . . . . . . . . . 71 3.5 Stubborn Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.5.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 3.5.3 Fail-Recovery Algorithm: Basic Stubborn Broadcast . . 73 3.6 Logged Best Effort Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 3.6.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 3.6.2 Fail-Recovery Algorithm: Logged Basic Broadcast . . . . 74 3.7 Logged Uniform
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . 75 3.7.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.7.2 Fail-Recovery Algorithm: Logged Majority-Ack URB . . 76 *DRAFT* XIV (22/11/2004) Contents Contents 3.8 Randomized Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 3.8.1 The Scalability of Reliable Broadcast . . . . . . . . . . . . . . . 78 3.8.2 Epidemic Dissemination . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 3.8.3 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 3.8.4 Randomized Algorithm: Eager Probabilistic Broadcast 80 3.8.5 Randomized Algorithm: Lazy Probabilistic Broadcast . 82 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Best-Effort Broadcast . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . 85 Lazy Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 All-Ack URB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Majority-Ack URB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Probabilistic Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Test Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . 97 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 4. Shared Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.1.1 Sharing Information in a Distributed System . . . . . . . . . 103 4.1.2 Register Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 4.1.3 Completeness and Precedence . . . . . . . . . . . . . . . . . . . . . . 107 4.2 (1,N) Regular Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 4.2.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . 108 4.2.2 Fail-Stop Algorithm: Read-One-Write-All Regular Reg-ister . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.2.3 Fail-Silent Algorithm: Majority-Voting Regular Register111 4.3 (1,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.3.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.3.2 Transformation: From (1,N) Regular to (1,N) Atomic . 116 4.3.3 Fail-Stop Algorithm: Read-One-Impose-All (1,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 4.3.4 Fail-Silent Algorithm: Read-Majority Impose-Majority (1,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 4.4 (N,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.4.1 Multiple Writers . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . 124 4.4.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.4.3 Transformation: From (1,N) atomic to (N,N) atomic registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 4.4.4 Fail-Stop Algorithm: Read-All-Impose-All (N,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 4.4.5 Fail-Silent Algorithm: Majority Voting (N,N) Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 4.5 (1,N) Logged Regular Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 4.5.1 Precedence in the Fail-Recovery Model . . . . . . . . . . . . . . 131 *DRAFT* XV (22/11/2004) Contents Contents 4.5.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . 132 4.5.3 Fail-Recovery Algorithm: Logged Majority Voting . . . . 133 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 5. Consensus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 5.1 Regular Consensus . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . 145 5.1.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 5.1.2 Fail-Stop Algorithm: Consensus with Flooding . . . . . . . 146 5.1.3 Fail-Stop Algorithm: Hierarchical Consensus . . . . . . . . . 149 5.2 Uniform Consensus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 5.2.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 5.2.2 Fail-Stop Algorithm: Uniform Consensus with Flooding 152 5.2.3 Fail-Stop Algorithm: Hierarchical Uniform Consensus . 152 5.2.4 Fail-Noisy Algorithm: Carefull Leader Algorythm . . . . . 154 5.3 Logged Consensus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 5.3.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 5.3.2 Fail-Recovery Algorithm: Logged Careful Reader . . . . . 160 5.4 Randomized Consensus . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . . . . . 161 5.4.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 5.4.2 A randomized Consensus Algorithm . . . . . . . . . . . . . . . . 163 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 6. Ordering . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . 184 6.2.3 Algorithm: Uniform Total Order Broadcast . . . . . . . . . . 185 6.3 Logged Total Order Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 6.3.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 6.3.2 Fail-Recovery Algorithm: Total Order Broadcast Al-gorithm with Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 No-Waiting Reliable Causal Order Broadcast . . . . . . . . . . . . . . 192 *DRAFT* XVI (22/11/2004) Contents Contents No-Waiting Reliable Causal Order Broadcast with Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Waiting Reliable Causal Order Broadcast . . . . . . . . . . . . . . . . . . 198 Uniform Total Order Broadcast . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . . 199 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 7. Coordination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 7.1 Terminating Reliable Broadcast . . . . . . . . . . . . . . . . . . . . . . . . . . 207 7.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 7.1.2 Specifications . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . 214 7.3.3 Fail-Stop Algorithm: Monarchical Leader Election . . . . 215 7.4 Group Membership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 7.4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 7.4.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 7.4.3 Fail-Stop Algorithm: Consensus-Based Group Mem-bership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 7.5 View-Synchronous Communication . . . . . . . . . . . . . . . . . . . . . . . 219 7.5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 7.5.2 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 7.5.3 Fail-Stop
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Algorithm: TRB-Based View-Synchrony . . . . 221 7.6 Probabilistic Partial Membership . . . . . . . . . . . . . . . . . . . . . . . . . 224 7.6.1 Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 7.6.2 Randomized Algorithm: Probabilistic Broadcast with Partial Membership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Hands-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Historical Notes . . . . . . . . . . . . . . . . . . . . . . . .
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
. . . . . . . . . . . . . . . . . . . . 233 *DRAFT* XVII (22/11/2004) 1. Introduction God does not often clap his hands. When he does, every body should dance (African Proverb) This chapter first motivates the need for distributed programming ab-stractions. Special attention is given to abstractions that capture the prob-lems that underly robust forms of cooperations between multiple processes in a distributed system, such as agreement abstractions. The chapter then advocates a modular strategy for the development of distributed programs by making use of those abstractions through specific Application Programming Interfaces (APIs). A concrete simple example API is also given to illustrate the notation and event-based invocation scheme used throughout the manuscript to describe the algorithms that implement our abstractions. The notation and invocation schemes are very close to those we have used to implement our algorithms in our Appia protocol framework. ## 1.1 Motivation Distributed computing has to do with devising algorithms for a set of pro-cesses that seek to achieve some form of cooperation. Besides executing con-currently, some of the processes of a distributed system might stop operating, for instance by crashing or being disconnected, while others might stay alive and keep operating. This very notion of partial failures is a characteristic of a distributed system. In fact, this can be useful if one really feels the need to differentiate a distributed system from a concurrent system. It is usual to quote Leslie Lamport here: “A distributed system is one in which the failure of a computer you did not even know existed can render your own computer unusable”. 1.1. MOTIVATION CHAPTER 1. INTRO When a subset of the processes have failed, or got disconnected, the chal-lenge is for the processes that are still operating to
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
synchronize their activities in a consistent way. In other words, the cooperation must be made robust to tolerate partial failures. This makes distributed computing quite hard, yet extremely stimulating, problem. As we will discuss in detail later in the manuscript, due to several factors such as the asynchrony of the underlying components and the possibility of failures in the communication infrastruc-ture, it may be impossible to accurately detect process failures, and in par-ticular distinguish a process failure from a network failure. This makes the problem of ensuring a consistent cooperation even more difficult. The chal-lenge of researchers in distributed computing is precisely to devise algorithms that provide the processes that remain operating with enough consistent in-formation so that they can cooperate correctly and solve common tasks. In fact, many programs that we use today are distributed programs. Simple daily routines, such as reading e-mail or browsing the web, involve some form of distributed computing. However, when using these applica-tions, we are typically faced with the simplest form of distributed computing: client-server computing. In client-server computing, a centralized process, the server , provides a service to many remote clients . The clients and the server communicate by exchanging messages, usually following a request-reply form of interaction. For instance, in order to display a web page to the user, a browser sends a request to the WWW server and expects to obtain a response with the information to be displayed. The core difficulty of distributed com-puting, namely achieving a consistent form of cooperation in the presence of partial failures, may be revealed even by using this simple form of interaction. Going back to our browsing example, it is reasonable to expect that the user continues surfing the web if the site it is consulting fails (by automatically switching to other sites), and
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
even more reasonable that the server process keeps on providing information to the other client processes, even when some of them fail or got disconnected. The problems above are already difficult to deal with when distributed computing is limited to the interaction between two parties, such as in the client-server case. However, there is more to distributed computing than client-server computing. Quite often, not only two, but several processes need to cooperate and synchronize their actions to achieve a common goal. The existence of not only two, but multiple processes does not make the task of distributed computation any simpler. Sometimes we talk about multi-party interactions in this general case. In fact, both patterns might coexist in a quite natural manner. Actually, a real distributed application would have parts following a client-server interaction pattern and other parts following a multi-party interaction one. This might even be a matter of perspective. For instance, when a client contacts a server to obtain a service, it may not be aware that, in order to provide that service, the server itself may need to re-*DRAFT* 2 (22/11/2004) CHAPTER 1. INTRO 1.2. ABSTRACTIONS quest the assistance of several other servers, with whom it needs to coordinate to satisfy the client’s request. ## 1.2 Distributed Programming Abstractions Just like the act of smiling, the act of abstraction is restricted to very few natural species. By capturing properties which are common to a large and sig-nificant range of systems, abstractions help distinguish the fundamental from the accessory and prevent system designers and engineers from reinventing, over and over, the same solutions for the same problems. From The Basics. Reasoning about distributed systems should start by ab-stracting the underlying physical system: describing the relevant components in an abstract way, identifying their intrinsic properties, and characterizing their interactions, leads
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
to what is called a system model . In this book we will use mainly two abstractions to represent the underlying physical system: processes and links .The processes of a distributed program abstract the active entities that perform computations. A process may represent a computer, a processor within a computer, or simply a specific thread of execution within a pro-cessor. To cooperate on some common task, the processes might typically need to exchange messages using some communication network. Links ab-stract the physical and logical network that supports communication among processes. It is possible to represent different realities of a distributed system by capturing different properties of processes and links, for instance, by de-scribing the different ways these components may fail. Chapter 2 will provide a deeper discussion on the various distributed systems models that are used in this book. To The Advanced. Given a system model, the next step is to understand how to build abstractions that capture recurring interaction patterns in dis-tributed applications. In this book we are interested in abstractions that capture robust cooperation problems among groups of processes, as these are important and rather challenging. The cooperation among processes can sometimes be modelled as a distributed agreement problem. For instance, the processes may need to agree if a certain event did (or did not) take place, to agree on a common sequence of actions to be performed (from a number of initial alternatives), to agree on the order by which a set of inputs need to be processed, etc. It is desirable to establish more sophisticated forms of agreement from solutions to simpler agreement problems, in an incremental manner. Consider for instance the following problems: • In order for processes to be able to exchange information, they must ini-tially agree on who they are (say using IP
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
addresses) and some common format for representing messages. They might also need to agree on some reliable way of exchanging messages (say to provide TCP-like semantics). *DRAFT* 3 (22/11/2004) 1.2. ABSTRACTIONS CHAPTER 1. INTRO • After exchanging some messages, the processes may be faced with sev-eral alternative plans of action. They may then need to reach a consensus on a common plan, from all alternatives, and each participating process may have initially its own plan, different from the plans of the remaining processes. • In some cases, it may be only acceptable for the cooperating processes to take a given step if all other processes also agree that such a step should take place. If this condition is not met, all processes must agree that the step should not take place. This form of agreement is utmost importance in the processing of distributed transactions, where this problem is known as the atomic commitment problem. • Processes may need not only to agree on which actions they should execute but to agree also on the order by which these actions need to be executed. This form of agreement is the basis of one of the most fundamental tech-niques to replicate computation in order to achieve fault-tolerance, and it is called the total order problem. This book is about mastering the difficulty underlying these problems, and devising abstractions that encapsulate such problems. In the following, we try to motivate the relevance of some of the abstractions covered in this manuscript. We distinguish the case where the abstractions pop up from the natural distribution of the abstraction, from the case where these abstractions come out as artifacts of an engineering choice for distribution. 1.2.1 Inherent Distribution Applications which require sharing or dissemination of information among several participant processes are a fertile ground for
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
the emergence of dis-tributed programming abstractions. Examples of such applications are in-formation dissemination engines, multi-user cooperative systems, distributed shared spaces, cooperative editors, process control systems, and distributed databases. Information Dissemination. In distributed applications with information dissemination requirements, processes may play one of the following roles: information producers, also called publishers , or information consumers, also called subscribers . The resulting interaction paradigm is often called publish-subscribe .Publishers produce information in the form of notifications. Subscribers register their interest in receiving certain notifications. Different variants of the paradigm exist to match the information being produced with the sub-scribers interests, including channel-based, subject-based, content-based or type-based subscriptions. Independently of the subscription method, it is very likely that several subscribers are interested in the same notifications, which will then have to be multicast. In this case, we are typically interested in hav-ing subscribers of the same information receiving the same set of messages. *DRAFT* 4 (22/11/2004) CHAPTER 1. INTRO 1.2. ABSTRACTIONS Otherwise the system will provide an unfair service, as some subscribers could have access to a lot more information than other subscribers. Unless this reliability property is given for free by the underlying infras-tructure (and this is usually not the case), the sender and the subscribers may need to coordinate to agree on which messages should be delivered. For instance, with the dissemination of an audio stream, processes are typ-ically interested in receiving most of the information but are able to toler-ate a bounded amount of message loss, especially if this allows the system to achieve a better throughput. The corresponding abstraction is typically called a best-effort broadcast .The dissemination of some stock exchange information might require a more reliable form of broadcast, called reliable broadcast , as we would like all active processes to receive the same information. One might even
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
require from a strock exchange infrastructure that information be disseminated in an ordered manner. The adequate communication abstraction that offers order-ing in addition to reliability is called total order broadcast . This abstraction captures the need to disseminate information, such that all participants can get a consistent view of the global state of the disseminated information. In several publish-subscribe applications, producers and consumers in-teract indirectly, with the support of a group of intermediate cooperative brokers. In such cases, agreement abstractions might be useful for the coop-eration of the brokers. Process Control. Process control applications are those where several soft-ware processes have to control the execution of a physical activity. Basically, the (software) processes might be controlling the dynamic location of an air-craft or a train. They might also be controlling the temperature of a nuclear installation, or the automation of a car production system. Typically, every process is connected to some sensor. The processes might for instance need to exchange the values output by their assigned sensors and output some common value, say print a single location of the aircraft on the pilot control screen, despite the fact that, due to the inaccuracy or failure of their local sensors, they may have observed slightly different input val-ues. This cooperation should be achieved despite some sensors (or associated control processes) having crashed or not observed anything. This type of co-operation can be simplified if all processes agree on the same set of inputs for the control algorithm, a requirement captured by the consensus abstraction. Cooperative Work. Users located on different nodes of a network might cooperate in building a common software or document, or simply in setting-up a distributed dialogue, say for a virtual conference. A shared working space abstraction is very useful here to enable effective cooperation. Such distributed shared
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
memory abstraction is typically accessed through read and write operations that the users exploit to store and exchange information. In its simplest form, a shared working space can be viewed as a virtual register or a distributed file system. To maintain a consistent view of the shared *DRAFT* 5 (22/11/2004) 1.2. ABSTRACTIONS CHAPTER 1. INTRO space, the processes need to agree on the relative order among write and read operations on that shared board. Distributed Databases. These constitute another class of applications where agreement abstractions can be helpful to ensure that all transaction managers obtain a consistent view of the running transactions and can make consistent decisions on the way these transactions are serialized. Additionally, such abstractions can be used to coordinate the transaction managers when deciding about the outcome of the transactions. That is, the database servers on which a given distributed transaction has executed would need to coordinate their activities and decide on whether to commit or abort the transaction. They might decide to abort the transaction if any database server detected a violation of the database integrity, a concurrency control inconsistency, a disk error, or simply the crash of some other database server. An distributed programming abstraction that is useful here is the atomic commit (or commitment) form of distributed cooperation. 1.2.2 Distribution as an Artifact In general, even if the application is not inherently distributed and might not, at first glance, need sophisticated distributed programming abstractions, this need sometimes appears as an artifact of the engineering solution to satisfy some specific requirements such as fault-tolerance , load-balancing , or fast-sharing .We illustrate this idea through replication, which is a powerful way to achieve fault-tolerance in distributed systems. Briefly, replication consists in making a centralized service highly-available by executing several copies of it on several machines that
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
are presumably supposed to fail independently. The service continuity is in a sense ensured despite the crash of a subset of the machines. No specific hardware is needed: fault-tolerance through replication is software-based. In fact, replication might also be used within an informa-tion system to improve the read-access performance to data by placing it close to the processes where it is supposed to be queried. For replication to be effective, the different copies must be maintained in a consistent state. If the state of the replicas diverge arbitrarily, it does not make sense to talk about replication anyway. The illusion of one highly-available service would brake and replaced by that of several distributed services, each possibly failing independently. If replicas are deterministic, one of the simplest manners to guarantee full consistency is to ensure that all replicas receive the same set of requests in the same order. Typically, such guarantees are enforced by an abstraction called total order broadcast and discussed earlier: the processes need to agree here on the sequence of messages they deliver. Algorithms that implement such a primitive are non-trivial, and providing the programmer with an abstraction that encapsulates these algorithms makes the design of replicated components easier. If replicas are *DRAFT* 6 (22/11/2004) CHAPTER 1. INTRO 1.3. THE END-TO-END ARGUMENT non-deterministic, then ensuring their consistency requires different ordering abstractions, as we will see later in the manuscript. After a failure, it is desirable to replace the failed replica by a new com-ponent. Again, this calls for systems with dynamic group membership ab-straction and for additional auxiliary abstractions, such as a state-transfer mechanism that simplifies the task of bringing the new replica up-to-date. ## 1.3 The End-to-end Argument Distributed Programming abstractions are useful but may sometimes be dif-ficult or expensive to implement. In some cases, no simple
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
algorithm is able to provide the desired abstraction and the algorithm that solves the problem can have a high complexity, e.g., in terms of the number of inter-process com-munication steps and messages. Therefore, depending on the system model, the network characteristics, and the required quality of service, the overhead of the abstraction can range from the negligible to the almost impairing. Faced with performance constraints, the application designer may be driven to mix the relevant logic of the abstraction with the application logic, in an attempt to obtain an optimized integrated solution. The intuition is that such a solution would perform better than a modular approach, where the abstraction is implemented as independent services that can be accessed through well defined interfaces. The approach can be further supported by a superficial interpretation of the end-to-end argument: most complexity should be implemented at the higher levels of the communication stack. This argu-ment could be applied to any distributed programming. However, even if, in some cases, performance gains can be obtained by collapsing the application and the underlying layers, such an approach has many disadvantages. First, it is very error prone. Some of the algorithms that will be presented in this manuscript have a considerable amount of difficulty and exhibit subtle dependencies among their internal components. An apparently obvious “optimization” may break the algorithm correctness. It is usual to quote Knuth here: “Premature optimization is the source of all evil” Even if the designer reaches the amount of expertise required to mas-ter the difficult task of embedding these algorithms in the application, there are several other reasons to keep both implementations independent. The most important of these reasons is that there is usually no single solution to solve a given distributed computing problem. This is particularly true be-cause the variety of distributed
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
system models. Instead, different solutions can usually be proposed and none of these solutions might strictly be supe-rior to the others: each might have its own advantages and disadvantages, performing better under different network or load conditions, making differ-ent trade-offs between network traffic and message latency, etc. To rely on *DRAFT* 7 (22/11/2004) 1.4. SOFTWARE COMPONENTS CHAPTER 1. INTRO a modular approach allows the most suitable implementation to be selected when the application is deployed, or even commute in run-time among dif-ferent implementations in response to changes in the operational envelope of the application. Encapsulating tricky issues of distributed interactions within abstractions with well defined interfaces significantly helps reason about the correctness of the application and port it from one system to the other. We strongly believe that, in many distributed applications, especially those that require many-to-many interaction, building preliminary prototypes of the distributed application using several abstraction layers can be very helpful. Ultimately, one might indeed consider optimizing the performance of the final release of a distributed application and using some integrated prototype that implements several abstractions in one monolithic peace of code. How-ever, full understanding of each of the inclosed abstractions in isolation is fundamental to ensure the correctness of the combined code. ## 1.4 Software Components 1.4.1 Composition Model Notation. One of the biggest difficulties we had to face when thinking about describing distributed algorithms was to find out an adequate way to repre-sent these algorithms. When representing a centralized algorithm, one could decide to use a programming language, either by choosing an existing popular one, or by inventing a new one with pedagogical purposes in mind. Although there have indeed been several attempts to come up with dis-tributed programming languages, these attempts have resulted in rather com-plicated notations that would not have been viable to describe
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
general pur-pose distributed algorithms in a pedagogical way. Trying to invent a dis-tributed programming language was not an option. Had we had the time to invent one and had we even been successful, at least one book would have been required to present the language. Therefore, we have opted to use pseudo-code to describe our algorithms. The pseudo-code assumes a reactive computing model where components of the same process communicate by exchanging events: an algorithm is de-scribed as a set of event handlers, that react to incoming events and may trigger new events. In fact, the pseudo-code is very close to the actual way we programmed the algorithms in our experimental framework. Basically, the algorithm description can be seen as actual code, from which we removed all implementation-related details that were more confusing than useful for un-derstanding the algorithms. This approach will hopefully simplify the task of those that will be interested in building running prototypes from the de-scriptions found in the book. *DRAFT* 8 (22/11/2004) CHAPTER 1. INTRO 1.4. SOFTWARE COMPONENTS Component B Events Events Events Component A > Figure 1.1. Composition model A Simple Example. Abstractions are typically represented through ap-plication programming interfaces (API). We will informally discuss here a simple example API for a distributed programming abstraction. To describe this API and our APIs in general, as well as the algorithms implementing these APIs, we shall consider, throughout the manuscript, an asynchronous event-based composition model. Every process hosts a set of software modules, called components . Each component is identified by a name, characterized by a set of properties, and provides an interface in the form of the events that the component accepts and produces in return. Dis-tributed Programming abstractions are typically made of a collection of com-ponents, at least one on every process, that are supposed
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
to satisfy some common properties. Software Stacks. Components can be composed to build software stacks, at each process: each component represents a specific layer in the stack. The application layer is on the top of the stack whereas the networking layer is at the bottom. The layers of the distributed programming abstractions we will consider are in the middle. Components within the same stack commu-nicate through the exchange of events , as illustrated in Figure 1.1. A given abstraction is typically materialized by a set of components, each running at a process. According to this model, each component is constructed as a state-machine whose transitions are triggered by the reception of events. Events may carry information such as a data message, a group view, etc, in one or more attributes . Events are denoted by 〈 EventType , att1, att2, . . . 〉.Each event is processed through a dedicated handler by the process (i.e., the corresponding component). The processing of an event may result in new events being created and triggered on the same or on other components. Every event triggered on a component of the same process is eventually processed, *DRAFT* 9 (22/11/2004) 1.4. SOFTWARE COMPONENTS CHAPTER 1. INTRO unless the process crashes. Events from the same component are processed in the same order they were triggered. Note that this FIFO ( first-in-first-out ) order is only enforced on events exchanged among local components in a given stack. The messages among different processes may also need to be ordered according to some criteria, using mechanisms orthogonal to this one. We shall address this inter-process communication issue later in the book. We assume that every process executes the code triggered by events in a mutually exclusive way. Basically, the same process does not handle two events concurrently. Once the
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
handling of an event is terminated, the process keeps on checking if any other event is triggered. The code of each component looks like this: upon event 〈 Event1 , att 11, att 21, . . . 〉 do something // send some event trigger 〈 Event2 , att 12,att 22, . . . 〉; upon event 〈 Event3 , att 13, att 23, . . . 〉 do something else // send some other event trigger 〈 Event4 , att 14, att 24, . . . 〉; This decoupled and asynchronous way of interacting among components matches very well the requirements of distributed applications: for instance, new processes may join or leave the system at any moment and a process must be ready to handle both membership changes and reception of messages at any time. Hence, a process should be able to concurrently handle several events, and this is precisely what we capture through our component model. 1.4.2 Programming Interface A typical interface includes the following types of events: • Request events are used by a component to request a service from another component: for instance, the application layer might trigger a request event at a component in charge of broadcasting a message to a set of processes in a group with some reliability guarantee, or proposing a value to be decided on by the group. • Confirmation events are used by a component to confirm the completion of a request. Typically, the component in charge of implementing a broadcast will confirm to the application layer that the message was indeed broadcast or that the value suggested has indeed been proposed to the group: the component uses here a confirmation event. *DRAFT* 10 (22/11/2004) CHAPTER 1. INTRO 1.4. SOFTWARE COMPONENTS • Indication events are used by a given component
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
to deliver information to another component. Considering the broadcast example above, at every process that is a destination of the message, the component in charge of implementing the actual broadcast primitive will typically perform some processing to ensure the corresponding reliability guarantee, and then use an indication event to deliver the message to the application layer. Simi-larly, the decision on a value will be indicated with such an event. A typical execution at a given layer consists of the following sequence of actions. We consider here the case of a broadcast kind of abstraction, e.g., the processes need to agree on whether or not to deliver a message broadcast by some process. 1. The execution is initiated by the reception of a request event from the layer above. 2. To ensure the properties of the broadcast abstraction, the layer will send one or more messages to its remote peers using the services of the layer below (using request events). 3. Messages sent by the peer layers are also received using the services of the underlying layer (through indication events). 4. When a message is received, it may have to be stored temporarily until the adequate reliability property is satisfied, before being delivered to the layer above (using a indication event). This data-flow is illustrated in Figure 1.2. Events used to deliver informa-tion to the layer above are indications . In some cases, the layer may confirm that a service has been concluded using a confirmation event. Layer n (receive) (deliver) indication request request indication Layer n−1 Layer n+1 > Figure 1.2. Layering *DRAFT* 11 (22/11/2004) 1.4. SOFTWARE COMPONENTS CHAPTER 1. INTRO > Module: Name: Print (lpr). > Events: Request: 〈lprPrint , rqid, string 〉: Requests a string to be printed. The token rqid is an identifier of the request. >
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Confirmation: 〈lprOk , rqid 〉: Used to confirm that the printing request with identifier rqid succeeded. > Module 1.1 Interface of a printing module. > Algorithm 1.1 Printing service. > Implements: > Print (lpr). > upon event 〈lprPrint , rqid, string 〉do print string; > trigger 〈lprOk , rqid 〉; 1.4.3 Modules Not surprisingly, the modules described in this manuscript perform some interaction with the correspondent modules on peer processes: after all, this is a manuscript about distributed computing. It is however also possible to have modules that perform only local actions. To illustrate the notion of modules, we use the example of a simple print-ing module. This module receives a print request, issues a print command and provides a confirmation of the print operation having been achieved. Module 1.1 describes its interface and Algorithm 1.1 its implementation. The algorithm is supposed to be executed by every process pi.To illustrate the way modules are composed, we use the printing module above to build a bounded printing service. The bounded printer only accepts a limited, pre-defined, number of printing requests. The bounded printer also generates an indication when the threshold of allowed print requests is reached. The bounded printer uses the service of the (unbounded) printer introduced above and maintains a counter to keep track of the number of printing requests executed in the past. Module 1.2 provides the interface of the bounded printer and Algorithm 1.2 its implementation. To simplify the presentation of the components, we assume that a special 〈 Init 〉 event is generated automatically by the run-time system when a component is created. This event is used to perform the initialization of the component. For instance, in the bounded printer example, this event is used to initialize the counter of executed printing requests. *DRAFT* 12 (22/11/2004) CHAPTER
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
1. INTRO 1.4. SOFTWARE COMPONENTS > Module: Name: BoundedPrint (blpr). > Events: Request: 〈blprPrint , rqid, string 〉: Request a string to be printed. The token rqid is an identifier of the request. > Confirmation: 〈blprStatus , rqid, status 〉: Used to return the outcome of the printing request: Ok or Nok. > Indication: 〈blprAlarm 〉:Used to indicate that the threshold was reached. > Module 1.2 Interface of a bounded printing module. > Algorithm 1.2 Bounded printer based on (unbounded) print service. > Implements: > BoundedPrint (blpr). > Uses: > Print (lpr). > upon event 〈Init 〉do > bound := PredefinedThreshold; > upon event 〈blprPrint , rqid, string 〉do if bound >0then > bound := bound-1; > trigger 〈lprPrint , rqid, string 〉; > if bound = 0 then trigger 〈blprAlarm 〉; > else trigger 〈blprStatus , rqid, Nok 〉; > upon event 〈lprOk , rqid 〉do trigger 〈blprStatus , rqid, Ok 〉; 1.4.4 Classes of Algorithms As noted above, in order to provide a given service, a layer at a given process may need to execute one or more rounds of message exchange with the peer layers at remote processes. The behavior of each peer, characterized by the set of messages that it is capable of producing and accepting, the format of each of these messages, and the legal sequences of messages, is sometimes called a protocol . The purpose of the protocol is to ensure the execution of some distributed algorithm , the concurrent execution of different sequences of steps that ensure the provision of the desired service. This manuscript covers several of these distributed algorithms. To give the reader an insight of how design solutions and system-related parameters affect the algorithm design, the book includes five different classes *DRAFT* 13 (22/11/2004) 1.4. SOFTWARE COMPONENTS CHAPTER 1. INTRO
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
of algorithmic solutions to implement our distributed programming abstrac-tions, namely: fail-stop algorithms, designed under the assumption that pro-cesses can fail by crashing but the crashes can be reliably detected by all the other processes; fail-silent algorithms where process crashes can never be reliably detected; fail-noisy algorithms, where processes can fail by crashing and the crashes can be detected, but not always in a reliable manner; fail-recovery algorithms, where processes can crash and later recover and still participate in the algorithm; randomized algorithms, where processes use randomization to ensure the properties of the abstraction with some known probability. These classes are not disjoint and it is important to notice that we do not give a solution from each class to every abstraction. First, there are cases where it is known that some abstraction cannot be implemented from an algorithm of a given class. For example, the coordination abstractions we consider in Chapter 7 do not have fail-noisy (and hence fail-silent) solutions and it is not clear either how to devise meaningful randomized solutions to such abstractions. In other cases, such solutions might exist but devising them is still an active area of research. Reasoning about distributed algorithms in general, and in particular about algorithms that implement distributed programming abstractions, first goes through defining a clear model of the distributed system where these al-gorithms are supposed to operate. Put differently, we need to figure out what basic abstractions the processes assume in order to build more sophisticated ones. The basic abstractions we consider capture the allowable behavior of the processes and their communication links in the distributed system. Before delving into concrete algorithms to build sophisticated distributed program-ming abstractions, we thus need to understand such basic abstractions. This will be the topic of the next chapter. *DRAFT* 14 (22/11/2004) CHAPTER 1. INTRO
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Hands-On ## Hands-On We have implemented several of the algorithms that we will be presenting in the book. By using these implementations, the reader has the opportunity to run and experiment the algorithms in a real setting, look at the code, make changes and improvements to the given code and, eventually, take it as a basis to implement her own algorithms. The algorithms have been implemented in the java programming language with the support of the Appia protocol composition and execution frame-work (Miranda, Pinto, and Rodrigues 2001). Appia is a tool that simplifies the development of communication protocols. To start with, Appia already implements a number of basic services that are required in several protocols, such as methods to add and extract headers from messages or launch timers. Additionally, Appia simplifies the task of composing different protocol mod-ules. Central to the use of Appia is the notion of protocol composition . In its simpler form, a protocol composition is a stack of instances of the Layer class. For each different protocol module, a different specialization of the Layer class should be defined. In Appia , modules communicate through the exchange of events . Appia defines the class Event , from which all events exchanged in the Appia framework must be derived. In order for a module to consume and produce events, a layer must explicitly declare the set of events accepted , provided , and required . When a layer requires an event, Appia checks if there is another layer in the composition that provides that event, otherwise it generates an exception. This offers a simple form of detecting inconsistencies in the protocol composition. Print Module Consider for instance the implementation of the Print module (Module 1.1). In first place, we define the events accepted and provided by this module.
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
This is illustrated in Listing 1.1. Listing 1.1. Events for the Print module. > class PrintRequestEvent extends Event { > int rid ; String data; > void setId ( int rid ); > void setStrint ( String s ); > int getId (); String getString (); > } > class PrintConfirmEvent extends Event { > int rid ; > void setId ( int rid ); > int getId (); > } *DRAFT* 15 (22/11/2004) Hands-On CHAPTER 1. INTRO Then, we implement the layer for this module. This is illustrated in List-ing 1.2. As expected, the layer accepts the PrintRequestEvent and provides the PrintConfirmEvent . The PrintLayer is also responsible for creating objects of class PrintSession , whose purpose is described in the next paragraphs. Listing 1.2. PrintLayer. public class PrintLayer extends Layer { public PrintLayer() { /∗ events that the protocol will create ∗/ evProvide = new Class; evProvide = PrintConfirmEvent. class ; /∗ events that the protocol requires to work. This is ∗ a subset of the accepted events ∗/ evRequire = new Class; /∗ events that the protocol will accept ∗/ evAccept = new Class; evAccept = PrintRequestEvent. class ;evAccept = ChannelInit. class ; } public Session createSession() { return new PrintSession( this ); }} Layers are used to describe the behavior of each module. The actual meth-ods and the state required by the algorithm is maintained by Session objects. Thus, for every layer, the programmer needs to define the corresponding ses-sion. The main method of a session is the handle method, that is invoked by the Appia kernel whenever there is an event to be processed by the session. For the case of our Print module, the implementation of the PrintSession is given in Listing 1.3. Listing 1.3. PrintSession. public class PrintSession extends Session { public PrintSession(Layer
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
layer) { super (layer); } public void handle(Event event) { if (event instanceof ChannelInit) handleChannelInit((ChannelInit)event); else if (event instanceof PrintRequestEvent) { handlePrintRequest ((PrintRequestEvent)event); }} private void handleChannelInit(ChannelInit init) { try { init . go (); } catch (AppiaEventException e) { e.printStackTrace(); } *DRAFT* 16 (22/11/2004) CHAPTER 1. INTRO Hands-On > } > private void handlePrintRequest(PrintRequestEvent request) { > try { > PrintConfirmEvent ack = new PrintConfirmEvent (); doPrint (request. getString ()); request.go (); ack.setChannel(request.getChannel()); ack.setDir(Direction.UP); ack.setSource( this ); ack.setId(request.getId ()); ack. init (); ack.go (); > }catch (AppiaEventException e) { > e.printStackTrace(); > }}} There are a couple of issues the reader should note in the previous code. First, as in most of our algorithms, every session should be ready to accept the ChannelInit event. This event is automatically generated and should be used to initialize the session state. Second, in Appia , the default behaviour for a session is to always forward downwards (or upwards) in the stack the events it consumes . As it will become clear later in the text, it is often very convenient to have the same event be processed by different modules in sequence. BoundedPrint Module Having defined the events, the layer, and the session for the Print module, we can now perform a similar job for the BoundedPrint module (Module 1.2). As before we start by providing the required events, as depicted in Listing 1.4. Note that we define the PrintAlarmEvent and the PrintStatusEvent 11. On the other hand, we do not need to define a new event for the PrintRequestEvent ,as we can reuse the event used in the basic Print module. Listing 1.4. Events for BoundedPrint module. > class PrintAlarmEvent extends Event {} > class PrintStatusEvent extends Event { > int rid ; Status stat ; > void setId ( int
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
rid ); > void setStatus (Status s ); > int getId (); > int getStatus (); > } We proceed to define the BoundedPrintLayer , as depicted in Listing 1.5. Since the BoundedPrint module uses the services of the basic Print module, it requires the PrintConfirmEvent produced by that module. *DRAFT* 17 (22/11/2004) Hands-On CHAPTER 1. INTRO Listing 1.5. Bounded PrintLayer. public class BoundedPrintLayer extends Layer { public BoundedPrintLayer() { /∗ events that the protocol will create ∗/ evProvide = new Class; evProvide = PrintStatusEvent. class ;evProvide = PrintAlarmEvent. class ; /∗ events that the protocol require to work. ∗ This is a subset of the accepted events ∗/ evRequire = new Class; evRequire = PrintConfirmEvent. class ; /∗ events that the protocol will accept ∗/ evAccept = new Class; evAccept = PrintRequestEvent. class ;evAccept = PrintConfirmEvent. class ;evAccept = ChannelInit. class ; } public Session createSession() { return new BoundedPrintSession( this ); }} Subsequently, we can implement the session for the BoundedPrint module, depicted in Listing 1.6. Listing 1.6. BoundedPrintSession. public class BoundedPrintSession extends Session { int bound; public BoundedPrintSession(Layer layer) { super (layer); } public void handle(Event event) { if (event instanceof ChannelInit) { handleChannelInit((ChannelInit)event); } else if (event instanceof PrintRequestEvent) { handlePrintRequest ((PrintRequestEvent)event); } else if (event instanceof PrintConfirmEvent) { handlePrintConfirm ((PrintConfirmEvent)event); }} private void handleChannelInit(ChannelInit init) { try { bound = PredefinedThreshold; init . go (); } catch (AppiaEventException e) { e.printStackTrace(); }} private void handlePrintRequest(PrintRequestEvent request) { if ( bound > 0) { bound = bound −1; *DRAFT* 18 (22/11/2004) CHAPTER 1. INTRO Hands-On try { request.go (); } catch (AppiaEventException e) { e.printStackTrace(); } if ( bound == 0) { PrintAlarmEvent alarm = new PrintAlarmEvent (); alarm.setChannel (request.getChannel()); alarm.setSource ( this ); alarm.setDir(Direction.UP); try { alarm. init (); alarm.go (); } catch (AppiaEventException e)
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
{ e. printStackTrace(); }}} else { PrintStatusEvent status = new PrintStatusEvent (); status .setChannel (request.getChannel()); status .setSource ( this ); status . setDir(Direction. UP); status . setId ( request.getId ()); status . setStatus ( Status.NOK); try { status . init (); status .go (); } catch (AppiaEventException e) { e.printStackTrace(); }}} private void handlePrintConfirm(PrintConfirmEvent conf) { PrintStatusEvent status = new PrintStatusEvent (); status .setChannel (request.getChannel()); status .setSource ( this ); status . setDir(Direction.UP); status . setId ( conf.getId ()); status . setStatus ( Status.OK); try { status . init (); status .go (); } catch (AppiaEventException e) { e.printStackTrace(); }}} Composing Modules The two modules that we have described can then be easily composed using the Appia framework. The first step consists in creating a protocol composi-tion by stacking the BoundedPrintLayer on top of a the PrintLayer . Actually, in order to be able to experiment with these two layers, we further add on top of the stack a simple application layer. A protocol composition in Appia is called a QoS (Quality of Service) and can simply be created by providing the desired array of layers, as shown in Listing 1.7. After defining a protocol com-position, it is possible to create one or more communication channels that *DRAFT* 19 (22/11/2004) Hands-On CHAPTER 1. INTRO Channel Layers > CreateChannel createSession() createSession() createSession() Sessions QoS > PrintSession PrintSession BoundedPrintSession PrintApplSession PrintLayer BoundedPrintSession BoundedPrintLayer PrintApplSession PrintApplLayer PrintLayer BoundedPrintLayer PrintApplLayer Figure 1.3. Layers, Sessions, QoS and Channels use that composition. Therefore, channels can be seen as instances of proto-col compositions. Channels are made of sessions . When a channel is created from a composition, it is possible to automatically create a new session for every layer in the composition. The relation between Layers, Sessions, QoS and Channles is illustrated in Figure 1.3. The code
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
required to perform create a channel is also depicted in Listing 1.7. Listing 1.7. Creating a PrintChannel. public class Example { public static void main(String[] args) { /∗ Create layers and put them on a array ∗/ Layer [] qos = {new PrintLayer(), new BoundedPrintLayer(), new PrintApplicationLayer() }; /∗ Create a QoS ∗/ QoS myQoS = null ; try { myQoS = new QoS(”Print stack”, qos); } catch (AppiaInvalidQoSException ex) { System.err. println (”Invalid QoS”); System.err. println (ex.getMessage()); System.exit(1); } /∗ Create a channel. Uses default event scheduler. ∗/ Channel channel = myQoS.createUnboundChannel(”Print Channel”); try { *DRAFT* 20 (22/11/2004) CHAPTER 1. INTRO Hands-On channel. start (); } catch (AppiaDuplicatedSessionsException ex) { System.err. println (”Error in start”); System.exit(1); } /∗ All set . Appia main class will handle the rest ∗/ System.out.println(”Starting Appia...” ); Appia.run(); }} The reader is now invited to install the Appia distribution provided as a companion of this book and try the implementations described above. *DRAFT* 21 (22/11/2004) 2. Basic Abstractions These are my principles. If you don’t like them, I have others. (Groucho Marx) Applications that are deployed in practical distributed systems are usually composed of a myriad of different machines and communication infrastruc-tures. Physical machines differ on the number of processors, type of proces-sors, amount and speed of both volatile and persistent memory, etc. Com-munication infrastructures differ on parameters such as latency, throughput, reliability, etc. On top of these machines and infrastructures, a huge variety of software components are sometimes encompassed by the same application: operating systems, file-systems, middleware, communication protocols, each component with its own specific features. One might consider implementing distributed services that are tailored to specific combinations of the elements listed above. Such implementation would depend on one type of machine, one form of communication, one dis-tributed operating system, etc. However, in
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
this book we are interested in studying abstractions and algorithms that are relevant for a wide range of distributed environments. In order to achieve this goal we need to capture the fundamental characteristics of various distributed systems in some basic abstractions, and on top of which we can later define other more elaborate, and generic, distributed programming abstractions. This chapter presents the basic abstractions we use to model a distributed system composed of computational entities ( processes ) communicating by ex-changing messages. Two kinds of abstractions will be of primary importance: those representing processes and those representing communication links . Not surprisingly, it does not seem to be possible to model the huge diversity of physical networks and operational conditions with a single process abstrac-tion and a single link abstraction. Therefore, we will define different instances for each kind of basic abstraction: for instance, we will distinguish process ab-stractions according to the types of faults that they may exhibit. Besides our 2.1. COMPUTATION CHAPTER 2. BASICS process and link abstractions, we will introduce the failure detector abstrac-tion as a convenient way to capture assumptions that might be reasonable to make on the timing behavior of processes and links. Later in the chapter we will identify relevant combinations of our three categories of abstractions. Such a combination is what we call a distributed system model .This chapter also contains our first module descriptions, used to specify our basic abstractions, as well as our first algorithms, used to implement these abstractions. The specifications and the algorithms are rather simple and should help illustrate our notation, before proceeding in subsequent chapters to more sophisticated specifications and algorithms. ## 2.1 Distributed Computation 2.1.1 Processes and Messages We abstract the units that are able to perform computations in a distributed system through the notion of
|
{
"page_id": null,
"source": 7326,
"title": "from dpo"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.