mar21.txt ------------------------ HW6, due Friday, April 5: 14.7, 8, 10, 11, 12, 13, 15 (7 exercises, tentatively) Due Tuesday, March 26: Cluster into ``hard'' and ``easy'' clumps. ------------------------ Really no hope for crash-tolerant consensus, asynchronously? Section 14.3: 1. With 2-level information gathering, *can* do a lot. 2. With randomization, can even solve it. ------------------------ Setting: Message passing, complete network, crashes allowed ------------------------ Basic broadcast: Just what you expect (pp. 163-164) --success may be ``partial'' (if crash) --easy, using the provided network Reliable broadcast: Every crash clean (pp. 174-175) (bc reaches one survivor ==> it reaches all) (No claim about what reaches a process that crashes anyway.) How get the reliable version? Require basic broadcast of copies on each first receipt. But actually ``accept'' each message only once. See p. 183. Note: Messages typically include ``to,'' ``from,'' and some sort of ``msg. id'' or ``phase no.'' ------------------------ Question: With clean crashes now, why not simply simulate the 1-round synchronous protocol of Exercise 5.2? Answer: Wait how long for ``all'' results? Can't tell crashers from stragglers! ------------------------ Further assumption: At most f crashes, n relatively large (n > 3f, say). Key trick: *Can* safely wait for n-f (but *not* know *which*, or whether more will follow!). Proposed 2-level protocol: Broadcast your preference. Wait until receive at least n-f of these. v := majority preference (so far) (or prearranged default, if none) Broadcast your outcome v. Wait until receive at least n-f of *these*. Unanimous (so far) ==> settle on v; otherwise, ``unsure'' Lemma 0: Input unanimous ==> everyone settles on it. (Remaining cases: Only issue is *agreement*.) Lemma 1: If your ``majority'' was *unanimous*, then *everyone* (alive) will at least see a *majority* for v (since n-2f > f), hence settle on v. Lemma 2: If you settle on v, then no one else settles on any *other* value (since 2(n-f) > n). I.e., all settlements are on the same value. So only worry is ``unsure'' conclusions. If anyone settled, though, all of them will be ``close'' (within f). So patch to settle for ``close''? But then what about slight variation from *that*? Settle also for ``close to close'' (with 2f)? Problem: Wherever you ``draw the line,'' there may be straddlers! (E.g., consider original preferences half 0's, half 1's ... .) (And drawing the line *too* far from unanimity will spoil Lemma 2, perhaps forcing you to increase the required gap between f and n.) Note: Is this finally intuitive support for the impossibility result? ------------------------ Randomization to the rescue: Rather than settle, try again, using as preferences the contemplated settlements (promising, by Lemma 2) when they exist, and *random coin flips* when ``unsure.'' Question: Since this wouldn't have happened in the one constrained case (Lemma 0), why not use coin flips (or even a prearranged *default*!) for *all* the new preferences? Answer: Only the ``unsure'' processors know we have not already *reached* consensus! Question: But then everyone has to go on; when can anyone stop? Answer: Can *make decision* when see unanimity of preference. In next phase, if not now, *all* will see this. So do need to continue for participation for one more phase. But others might believe *yet another* phase is needed. Therefore, stopping continues to have potential to mess something up, since each phase's argument needed n-f continuing processors! Result: Chance is at least 1/2^n of unanimous preference in next phase. Therefore, expected number of phases until agreement is at most 2^n, and probability of ultimate agreement is 1 (not same as certainty!). Note that we have weakened the notion of termination a little: 1. Probability 1 decision, rather than in *every* execution. 2. Run forever. (Fixable??) Does even this bound say anything about needed number of turns? No, since a nasty (but admissible) scheduler (``adversary'') might hold up f+1 processors for arbitrarily long. Can we achieve a more realistic expected number of phases to consensus? Yes! (Next time (again using 2-level information gathering).)