Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem.

Similar presentations


Presentation on theme: "1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem."— Presentation transcript:

1 1 Consensus Hierarchy Part 1

2 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem

3 3 Every process starts with an initial value stored in local memory (0 or 1) Shared memory Local memory Local memory

4 4 communication through shared memory

5 5 At the end of execution, every process has decided the same value (0 or 1)

6 6 Validity condition: If every process starts with the same value, the every process should decide that value Additional condition: The decided value is one of the initial values

7 7 Wait-freedom in asynchronous systems: A process should be able to finish execution of an algorithm even if all other processes fail Wait-freedom captures: Asynchronous executions Crash failures

8 8 Object Types Read/Write FIFO Compare&Swap Test&Set n-register assignment

9 9 Consensus Number Consensus Number of an object type: The maximum number of processes for which the object can be used to solve the wait-free consensus problem (together with read/write objects)

10 10 Object TypeConsensus Number Read/Write 1 FIFO, Test&Set 2 Compare&Swap (infinity) n-register assignment2n-2

11 11 int compare_and_swap ( int* register, int oldval, int newval) { int old_reg_val = *register; if (old_reg_val == oldval) *register = newval; return old_reg_val; } int Test-and-Set(boolean lock) { boolean initial = lock; lock = true; return initial; } (Shared ) boolean lock = false; function Critical_Section() { while TestAndSet(lock) skip //spin until lock is acquired //Critical-section code - only one process can be in this section at a time begin { … } //end-of critical section – release lock lock = false //release lock when finished with the critical section } Mutual Exclusion

12 12 Simulation: Object Type B Object Type A Read/Write Object Object of type A simulates object of Type B (using auxiliary read/write objects)

13 13 Theorem:Objects of Type A with consensus number cannot simulate in wait-free manner another object of Type B with consensus number Proof: Since otherwise, object A would have consensus number End of Proof

14 14 can simulate in a wait-free manner any other arbitrary object Universal object: Compare&SwapExample: (infinity consensus number)

15 15 Objects with consensus number can simulate in a wait-free manner any other arbitrary object of up to processors We can show:

16 16 Read/Write Shared Memory Suppose that the shared memory can only be accessed through Read or Write operations

17 17 Theorem: Proof of Theorem: The consensus number of the Read/Write object is 1 Trivially, any consensus algorithm with 1 process using read/write variables is wait-free.

18 18 Wait-free consensus cannot be solved using only read/write objects for processors It remains to show: We will show that any algorithm that solves wait-free consensus for has an execution that never terminates Approach:

19 19 System configuration: Is the set of all variables in the system, including local and shared

20 20 A distributed system execution can be always be viewed as a: sequence of configurations Initial configuration Final configuration Processor action: Read or Write

21 21 bivalent univalent bivalent Valence of system configurations 1-valent 0-valent Consensus value at possible execution paths consensus reached consensus not reached consensus reached

22 22 A terminating execution: Initial configuration Bivalent Univalent Bivalent Final configuration

23 23 To prove the theorem, we will show that there is always an execution where every configuration is bivalent Initial configuration Bivalent Never-ending execution Bivalent

24 24 Similar configurations for processor Same shared variables Local variables of others may differ

25 25 Lemma:If there exist univalent configurations and such that then if is -valent then is -valent too Proof of Lemma:

26 26 Univalent Execution with only taking actions All possible executions from final decision for each Possible execution

27 27 Univalent Execution with only taking actions Univalent Execution with only taking actions

28 28 Univalent Execution with only taking actions Univalent Execution with only taking actions

29 29 Univalent Execution with only taking actions Univalent Execution with only taking actions End of Lemma Proof

30 30 Lemma: There exists a bivalent initial configuration Proof of Lemma:

31 31 Possible Initial Configurations Shared Memory Empty Local Memory Initial Configuration

32 32 Possible Initial Configurations Shared Memory Empty Local Memory 0-valent1-valent ? Initial Configuration

33 33 Possible Initial Configurations Shared Memory Empty Local Memory 0-valent1-valent1-valent? No, because Initial Configuration

34 34 Possible Initial Configurations Shared Memory Empty Local Memory 0-valent1-valent0-valent? No, because Initial Configuration

35 35 Possible Initial Configurations Shared Memory Empty Local Memory 0-valent1-valentbivalent End of Lemma Proof Initial Configuration

36 36 Critical processor for a configuration: the configuration is bivalent, and after the processor takes step the configuration becomes univalent BivalentUnivalent

37 37 Lemma: If is a bivalent configuration then, there is at least one processor which is not critical Proof of Lemma:

38 38 Assume for contradiction that all processors are critical bivalent univalent Possible executions

39 39 bivalent valent It cannot be that all have the same valence valent

40 40 bivalent valent It cannot be that all have the same valence valent Contradiction

41 41 bivalent There must exist two processors with different valences

42 42 bivalent Case 1: suppose that they access different shared variables Read x Read y x y

43 43 bivalent Read x Read y two possible executions Read y Read x impossible since different valence

44 44 same result holds for any kind of operation (Read or Write) that the processors apply to x and y

45 45 bivalent Case 2: suppose that they access the same shared variable Read x x subcase: read/read

46 46 two possible executions bivalent Read x impossible since different valence

47 47 bivalent Read x Write x subcase: read/write

48 48 two possible executions bivalent Read x Write x Read x impossible since different valence

49 49 subcase: write/write bivalent Write x impossible since different valence

50 50 In all cases we obtained contradiction Therefore, there exists a processor which is not critical bivalent univalent bivalent (not critical) End of Lemma Proof

51 51 Therefore, we can construct an execution Initial configuration Never ends bivalent Consensus can never be reached End of Theorem Proof


Download ppt "1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem."

Similar presentations


Ads by Google