




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





CS425 Distributed Systems, Fall 2008, Instructor: Klara Nahrstedt
a. Using the Ring Election algorithm, show the election and reelection protocols when the following happens: âafter P2 receives the election result, P8 process crashesâ.
b. Using the Modified Ring Election algorithm, show the election and reelection protocols when the following happens: âafter P2 receives the list of all processes/attributes, P crashesâ.
c. Using Bully algorithm, show the election and reelection protocols when the following happens: âafter P8 was elected as a leader, it crashesâ.
d. Show the worst case message overhead in terms of number of messages exchanged during all three election algorithms if P8 through P4 processes crash at different time scales.
Solution: (Note: We will look at your solutions carefully how you assumed when which process crashes, since there are multiple solutions possible, depending on the assumption when you assumed in the algorithmic cycle that P8 failed).
a. Processes P1 through P8 are connected via logical ring. (1) Process P2 starts the election and sends its ID 2 to process P3 in clock-wise direction. P3 checks the received ID 2 and replaces it with ID 3 since it is larger, this continues until process P8 that puts the highest number forward. The second round from P8 is going to see if this is the largest number. Since the same number arrives the second round, the âelectedâ message is going to be sent out to elect P8 (number of messages to elect P8 is 6+8+8 = 22 messages), (2) Process P2 detects that P8 crashed, so it restarts the election process. Note that in the background the assumption is that once P crashed, the ring gets restored and there is communication between P7 and P1. P2 sends its ID to P3 and P3 replaces it with its own ID since it is higher, etc. P7 ID is the highest, hence ID 7 goes around to check with every other node after P7 that 7 is the highest. Once P7 sees 7 in the message, it assumes that it is the coordinator and sends âelectedâ message. Each nodes registers that P7 is the coordinator (number of messages to elect p7 is 5+7+7 = 19 messages)
b. Processes P1 through P8 are connected via logical ring. (1) P2 starts election and sends its ID to P3. P3 attaches its own ID to 2 (we have list of 2,3). List is sent to P4. P4 attaches its own ID 4, we have list (2,3,4,), etc. At the end of the round, P2 receives the list (2,3,4,5,6,7,8,1). (2) P selects the highest ID 8 as the coordinator, and sends âCoord[8]â through the ring with the IDs, each process attaches. P8 crashes during this process. It means P2 receives Coord[8] message
but only with list of nodes (2,3,4,5,6,7,1), i.e., ID 8 is missing, since P8 crashed, immediately after P2 got the list {2,3,4,5,6,7,8,1} and P2 made a selection of P8 as coordinator. Hence, P2 restarts the re-election process. Again, sends ID to P3, P3, attaches to the list its own ID, and at the end of this round, P2 gets list (2,3,4,5,6,7,1). It selects the highest id 7 and sends around the ring Coord[7] message. Each node attaches its own id as well to this message. Once P2 receives the Coord[7] message and the list and the list includes 7, the election is done and everybody accepts P7 to be the coordinator. (number of messages 8+7+7+7 = 29 messages)
c. P2 sends 6 election messages to P3, âŚP8, and receives 6 replies from all of them since all of them are up. P3 sends 5 messages to P4, âŚP8 and receives 5 replies, etc. P7 sends 1 election message to P8 and gets 1 reply. P8 is the highest ID so it elects itself as the coordinator (sends coordinator messages to P1âŚP7). Now once P8 crashes, (I assume) P2 detects it and restarts the election by sending 6 election messages to P3âŚP8, but receiving only 5 replies. P3 sends 5 election messages to higher IDs P4 âŚP8 and gets 4 replies back, etc. At the end P7 is the highest ID node that sends election message to P8, but does not get any reply and elects itself the coordinator (Number of messages 42 to elect P8, and 40 to elect P7. ). P7 sends coordinator messages to P1 ⌠P6 (number of messages 6 from coordinator)
d. Worst case:
(1) in case of Ring Algorithm, the worst case is if P1 starts election and then detects P8âŚP crash: 7+8+8 (elect P8) + 6+7+7 (elect P7, P8 crashed) + 5+6+6 (elect P6, P7, P8 crashed) + 4+5+ (elect P5) + 3+4+4 (elect P4) +2+3+3 (elect P3) , which is 93 messages.
(2) in case of modified Ring Algorithm, the worst case is if P1 starts election with 8 messages to get the full list to P1, P1 selects P8 as coordinator, then sends 7 messages to get the Coord message with the list since P8 crashed; then P1 restarts election , with 7 messages to get full list to P1, selects P7 as coordinator, then P7 crashes, hence 6 messages of Coord message will circulate; then P1 restarts the election with 6 messages to collect id list to P1, P1 selects P6 as coordinator, sends Coord message, P6 crashes, hence 5 messages circulate to P1, P1 restarts the election with 5 messages to collect id list to P1, P1 selects P5 as coordinator, sends Coord message, P5 crashes, hence 4 messages circulate to P1, P1 restarts the election with 4 messages to collect id list to P1, P1 selects P4 as coordinator, sends Coord message, P4 crashes, hence 3 messages circulate to P1, P1 restarts with 3 messages to collect id list to P1, P1 selects P3 as coordinator, sends Coord message, and after 3 messages, P1 gets the Coord message back with 3 ids, and coordinator has been determined. (8+27 + 26 + 25 + 24 + 3*3) = 61 messages.
(3) To elect P8, need 2*(7+6+5+4+3+2+1) election, OK messages (P1 starts election in worst case), 7 coordinator messages, which is 63 messages; then P8 crashes, P1 restarts election and we need 28 election messages and 21 OK messages to elect P7; P7 sends 6 coordinator messages, P7 crashes, P1 restarts and we need 28 election messages and 15 OK messages to elect P6, P6 sends 5 coordinator messages ; P6 crashes , P1 restarts and we need 28 election
Solutions:
The Chandy and Lamportâs snapshot algorithm works in a failure free environment with no failures. If one assumes asynchronous system with a failure (communication omission failure or processor crash failure), it is not possible to achieve 100% accuracy due to the impossibility of consensus in FLP paper for asynchronous systems. The problem will be that if there are communication failures, e.g., the initiator process may not know if markers arrived and other processes took the snapshot. Also if, e.g., the initiator crashes after multicasting the first marker, the other processes would not know if their markers arrived.
If we assume synchronous system, consensus should be possible to reach, i.e., if there is a communication failure or processor crash, due to timeouts, and other message/processing time bounds, the processes could detect if a message is lost or processes crashed and have a restart capability to try again for another global snapshot. So here the answer would be yes.
Solutions:
The schedules s1 and s2 are not commutative since the basic assumption in Lemma 1 (see FLP paper) of disjoint schedules is violated (process p1 belongs to schedules s1 and s2). (Lemma 1 states âif schedules are disjoint, then schedules are commutative.â).
Also we can see that ordering of s1, s2 yields configuration C3 = { p1, m1, m2; p2, m3} and ordering of schedules s2, s1 yields configuration C4 = {p1, m2, m1; p2; m3} and these configurations are not the same since in C3 ordering of messages in process p1 is m1, m2 and in C4 ordering of messages in process p1 is m2, m1 which yields different semantic results.
a. State the type of failure exhibited by a basic disk read.
b. Suggest how this failure may be masked in order to produce a different benign form of failure.
c. Suggest how to mask the benign failure all together.
Solutions: (Note: This problem also allows for different types of solutions how to mask the benign failures which will be considered).
(a) The failure is Byzantine arbitrary failure.
(b) To mask this failure to a different benign form of failure, we need to do checksum on disk block when reading and compare with the checksums of different reads of the same file and if different, issue an error to the application.
(c) We replicate the written file(block) to mask the error, read the file block from multiple replicated files, compare, and pick resulting block that has majority match.
a. Explain how Gnutella, FastTrack and Chord correct the scalability problem.
b. The problem of maintaining indexes of available resources is application-dependent. Consider suitability of each of the protocols in Exercise 6a for (1) music and media file sharing, (2) long terms storage of archived material such as journal or newspaper content, (3) network storage of general-purpose read-write files (e.g., word documents).
Solutions: (Note: This problem again may have different solutions depending on your assumptions about the application-dependent files. So if you stated clearly your assumptions and argued for your assumptions the appropriate P2P system, this should be fine.)
(a) Gnutella, Fast-Track and Chord do not have centralized index server, i.e., the index tables for searching files are distributed on many peers, hence the query search scales better. Gnutella has flooding-based index table distribution, FastTrack introduces super-nodes and represents hybrid indexing scheme between Napster and Gnutela, and Chord introduces DHTs (via finger tables).
(b) The differentiation of the applications is in the type of files, the access pattern, size of the files, that the peers host. In music sharing application, files are read-only, stable, usually small, not much churn, but some files are more popular than others, hence P2P system like FastTrack might be most suitable where super-nodes host the index tables of many very popular music files.
In case of long term storage of archived material, Gnutella-like system may suffice since the files are read-only, quite large, stable (no churn), even popularity is not a big issue so the indexes that Gnutella would build up would not change very much, and search does not occur too frequently. Chord may allow for faster search (O(logN)), but the DHTs are too complex for this type of application, so Gnutella- like protocols might be sufficient.
In case of general purpose read-write files, Chord would be best since these files would change frequently, have high churn, change sizes, hence we need P2P system that does more efficient search and also dealing with dynamics which Chord does.