1 / 20

Chapter 4: roadmap

Chapter 4: roadmap. 4.1 Token Passing: Converting a Central Daemon to read/write 4.2 Data-Link Algorithms: Converting Shared Memory to Message Passing 4.3 Self-Stabilizing Ranking: Converting an Id-based System to a Special-processor System

turkj
Download Presentation

Chapter 4: roadmap

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4: roadmap 4.1 Token Passing: Converting a Central Daemon to read/write 4.2 Data-Link Algorithms: Converting Shared Memory to Message Passing 4.3 Self-Stabilizing Ranking: Converting an Id-based System to a Special-processor System 4.3 Self-Stabilizing Ranking: Converting an Id-based System to a Special-processor System 4.4 Update: Converting a Special Processor to an Id-based Dynamic System 4.5 Stabilizing Synchronizers: Converting Synchronous to Asynchronous Algorithms 4.6 Self-Stabilizing Naming in Uniform Systems: Converting Id-based to Uniform Dynamic Systems chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  2. Motivation • Question: can the tasks achieved in Id-based systems also be achieved in a uniform dynamic system? • Answer: No! • For example: Algorithm for Leader Election (in a uniform system, possible only by using randomization). • We are going to present a randomized self-stabilizing leader-election and naming algorithm for dynamic systems. • The algorithm stabilizes within O(d) cycles. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  3. Naming • Given any communication graph, with up to N identical processors we want to find a unique Id for each processor • At first, each processor has an arbitrary Id • By coloring the tree, we know if it is unique. If so, we’re done. Otherwise, the processor has to find a new Id • The idea of the propagation is similar to the Update Algorithm • Each processor chooses an Id and notifies all others by building a spanning tree • In our algorithm, an Id which already exists, will be replaced with a new one chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  4. Formalization • Each processor Pi has a table with at most N rows • This table is called: Processorsi • Each row represents the state of the processor in another tree, rooted at any other processor (we have N such processors) • Each processor also has a queue, Queuei, with at most N2 rows, that should have been in the Processorsi table but there is no space for them there • Each row contains: {tid, dis, f, color, ackclr, ot, ack, list, del} chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  5. Formalization (Cont.) Where: • tid is an identifier of a root of a tree (range: between 0 to N10). • dis is the distance of Pi from the root of this tree • f is a pointer to the parent of Pi in the tree. • coloris used to identify other trees with the sametid(range: between 0 to N10). • ackclris a boolean variable, and used by Pi to acknowledge to its parent that its color is known by all processors under Pi. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  6. Cont. • ot is a boolean variable, and used by Pi to notify the parent of the existence of another tree with the same tid. • ack is also a boolean variable, and used to notify the parent of Pi of the termination of the propagation of its new identifier. • list and del may contain up to N identifiers. • list is used by Pi to report to its parent the identifiers of the processors in its subtree. • del is used by Pi to notify its children in the tree of conflicting identifiers. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  7. The Coloring - finding double Ids Consider a tree T with tid=x. Whenever a processor Pi notices that all its children have its color, and their ackclr field is true, Pi randomly chooses a new color. Each non-root processor Pj repeatedly copies the color of its parent. If the color is new, Pj assigns false to its ackclr field. T X X Whenever a processor Pj changes its color from y to z, Pj checks whether it has a neighbor which belongs to a tree T’ rooted at processor withtid=xand with a color different from y and z. If so, Pj concludes that more than a single root of a tree withtid=xexists, and set the value ofotfield to true. The colors are chosen from a large range. Hence, there is a very high probability, that when a processor Pi chooses a new color, the color is new in the tree. We want to ensure that no two processors have the same chosen identifier. Whenever Pj reads that all its children have the same color as its own, and all their ackclr field is true, Pj assigns true to its ackclr field. Each processor repeatedly colors its tree with a randomly chosen color. X T’ example of one tree, rooted at a specific P. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  8. The update part • Processor Pi chooses a new Id • Pi notifies its children about its new Id, they notify their children, etc. • Thus, we actually build a spanning BFS tree • When getting to a leaf, the leaf acknowledges to its parent that it got the message • Each processor Pj which gets acknowledgements from all its children, sends an acknowledgement to its parent • When the root, Pi, gets acknowledgements from all its children, it knows that everyone knows its Id chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  9. Cont. • All notifications between processors, are tuples with • {tid, dis, f, color, ackclr, ot, ack, list, del} • where each field contains the appropriate data it wants its neighbors to see. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  10. The Algorithm • Each processor Pi reads the tables of its neighbors, over and over • ReadSeti is the union of the tuples Pi read from its neighbors • In each row of ReadSeti, Pi sets the value of the f field to be the appropriate neighbor. The value of the dis field is incremented by 1 • Pi adds a tuple with its own Id and dis=0 chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  11. Cont. • For every tid=x, Pi removes every tuple with tid=x which does not have the minimal value in the dis field • Pi sorts the remaining tuples in ReadSeti by the value of their dis fields. If there are more than N tuples left in ReadSeti, Pi assigns the first N tuples to Processorsi and the rest are enqueued in Queuei chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  12. What if there are two processors with the same Id? – First solution Pi Pj modifies the value of the fields: f, dis, ack and list. f – the new father – k. dis – the old dis + 1 ack – true if: 1. Pj‘s neighbors have same tid and dis+1. 2. Pj‘s children on tree have Pj‘s dis+1 and also have ack=true. X Thus, when the root gets acknowledgements from all its children, it gets also the list of all the processors in the tree. Now it can see if there are two identical Ids, and propagate to its children the list of those Ids, in the del field. When a processor Pj includes for the first time a tuple tk with tid=x from a neighbor Pk, Pj copies the value of the tuple fields of tk to the corresponding fields of tj . Pj The list field of Pj contains the names of all the processors in the subtree rooted at Pj Each processorPj participates in the propagation of information with feedback from every other processor, includingPi . But, this does not mean that there are no two trees with identical Ids!! Pk X X example of one tree, rooted at a specific P. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  13. What if there are two processors with the same Id? – Second solution • Each root colors its tree as we saw in the coloring part • If it finds out that its Id is not unique, it chooses a new one, and we start from the beginning… chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  14. Why does it work? • The range of the Ids is very big (till N10) • If a processor found out that another processor has the same Id, then it chooses a new one • The choice is made by luck, from the scheduler-luck game. • The probability of choosing an existing identifier is negligible. But, it could be that the result of the random function is not identical to luck’s choice in the game (the new Id already appears in the system) • In such a case, we start the algorithm from the beginning, with the arbitrary configuration we have Thus, every processor selects a new identifier no more than once. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  15. The reason for the Queue table • When a processor Pi chooses a new identifier, a tuple with tid= IDi and dis= 0 is repeatedly written in Processorsi. • This action starts the construction of the spanning tree rooted in Pi that is identified by tid= IDi. • Still, tuples with the previous identifier of Pi may be present in Processors variables. • Thus, since the number of tuples in each Processors variable is bounded, it is unclear whether every processor can include the new tuple in its Processors variable. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  16. The Queue table – cont. • A processor that chooses a new identifier leaves floating tuples with small distances in the system. • These tuples compete with entries of the Processors variables. • Thus, it is possible that part of the tree will be disconnected, not participating in the coloring process, and thus cause a false other-trees indication. • To overcome such a scenario, each processor maintains a queue. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  17. The Queue • When each processor chooses an identifier no more than once, the number of distinct identifiers present in the Processors variables during the entire execution is no greater than N+N2. • Therefore, it is possible to use a queue of N2 entries to ensure that, once a tuple with a specific identifier is included in Processorsi, a tuple with this identifier exists in either Processorsi or Queuei. • Whenever Pi computes a new value for Processorsi, it deletes from Queuei every tuple with the same tid (keeps only the minimal tid). Thus, there are no two rows with an identical tid value in Queuei. chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  18. Correctness • Lemma: In any given configuration, the number of distinct identifiers is less than N8 • Proof: Each tuple may contain no more than 2N+1 distinct identifiers (in tid, list and del). The number of tuples in Processorsi and in Queuei is at most N+N2. Furthermore, each processor Pi maintains two internal variables for each neighbor. Thus, the total number of distinct identifiers is no greater than (2N+1)(N+N2)N < N8 (for N > 1) chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  19. Correctness – cont. • Lemma: The probability that every identifier-choose operation, in a sequence of N identifier-choose operations, results in a nonexistent identifier is greater than ½ • Proof: The probability that a single identifier choose operation results in a nonexistent identifier is at least (1 - n8/n10) = (1 - 1/n2). And (1 - 1/n2)N > ½ for a sequence of N choose operations (N > 1) chapter 4 - Self-Stabilizing Algorithms for Model Conservation

  20. Correctness – cont. • Theorem: A safe configuration is reached in an expected O(d) cycles • Outline of proof: The combined probability of the scheduler-luck game is greater than ½, and the expected number of cycles of the execution of the game is O(d) (like in the update algorithm) chapter 4 - Self-Stabilizing Algorithms for Model Conservation

More Related