Feb23Lecture

# Feb23Lecture - CIS 540 Principles of Embedded Computation...

• Notes
• 21

This preview shows pages 1–6. Sign up to view the full content.

CIS 540 Principles of Embedded Computation Spring 2017 Instructor: Rajeev Alur [email protected]

This preview has intentionally blurred sections. Sign up to view the full version.

Consensus Each process starts with an initial preference value, known only to itself Goal of coordination: Exchange information and arrive at a common decision value Our focus: Two processes with Boolean preferences, and communicating by shared memory Classical version: Byzentine Generals Problem communicating by messengers to decide on whether or not to attack Modern version: consistency of replicated data (see Paxos protocol) Processes P1 and P2 start with initial Boolean preferences v1 and v2, and arrive at Boolean decisions d1 and d2 so that 1. Agreement: d1 must equal d2 2. Validity: The decision value must equal either v1 or v2 3. Wait-freedom: At any time, if only one process is executed without interruption, it reaches a decision (does not have to wait for the other, and thus, tolerant to failures) CIS 540 Spring 2017; Lecture Feb 21
Solving Consensus Solving consensus using only atomic registers is impossible!! Primitives of read and write are too weak to achieve desired coordination while satisfying all 3 requirements Intuitive difficulty: When a process writes a shared variable, it does not know whether the other process has read this value, so cannot decide right away When a process reads a shared variable, it needs to communicate to other process that it has seen this value, so needs to continue Solution: Use stronger primitives: Test&Set registers Byzantine Generals Problem: Impossible to achieve coordination Sending a message, and receiving a message are similar to write and read operations CIS 540 Spring 2017; Lecture Feb 21

This preview has intentionally blurred sections. Sign up to view the full version.

Consensus using Test&Set Register x1:= pref1 y1 := test&set(y) AtomicReg bool x1, x2; Test&SetReg y :=0 Process P1 bool pref1, dec1 y1 := 0 if y1 =0 then dec1 := pref1 else dec1 := x2 Write your value to a shared var; execute test&set; if you win, choose your own initial value, else read other’s preference as decision value Agreement ? Validity ? Wait-freedom ? Process P2 bool pref2, dec2 x2:= pref2 y2 := test&set(y) y2 := 0 if y2 = 0 then dec2 := pref2 else dec2 := x1 CIS 540 Spring 2017; Lecture Feb 21
Leader Election Classical coordination problem: Elect a unique node as a leader Exchange messages to find out which nodes are in network Output the decision using the variable status Requirements Eventually every node sets status to either leader or follower

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Fall '09
• ALUR
• Lecture Feb

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern