Feb23Lecture - CIS 540 Principles of Embedded Computation...

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

View Full Document Right Arrow Icon
CIS 540 Principles of Embedded Computation Spring 2017 http://www.seas.upenn.edu/~cis540/ Instructor: Rajeev Alur [email protected]
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
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
Image of page 4
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
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern