Distributed Systems: Class 1 Aurojit Panda Please interrupt Please - - PowerPoint PPT Presentation

distributed systems class 1
SMART_READER_LITE
LIVE PREVIEW

Distributed Systems: Class 1 Aurojit Panda Please interrupt Please - - PowerPoint PPT Presentation

Distributed Systems: Class 1 Aurojit Panda Please interrupt Please interrupt When things seem unclear or we are going too fast. Administrivia Initial Bits If enrolled, you should have Piazza access. Come up if you do not. Waitlist:


slide-1
SLIDE 1

Distributed Systems: Class 1

Aurojit Panda

slide-2
SLIDE 2

Please interrupt

slide-3
SLIDE 3

Please interrupt

When things seem unclear or we are going too fast.

slide-4
SLIDE 4

Administrivia

slide-5
SLIDE 5

Initial Bits

  • If enrolled, you should have Piazza access. Come up if you do not.
  • Waitlist: There is still a waitlist.
  • If you are going to drop the class do it early.
  • Preference will be given to CS PhD students first.
  • Webpage is up, posted link on Piazza. Ask around if you don't know where.
  • All policies that follow are documented on the webpage.
slide-6
SLIDE 6

Personel

  • There is no TA at the moment.
slide-7
SLIDE 7

Personel

  • There is no TA at the moment.
  • My office hours are on Thursday from 5-6 PM.
slide-8
SLIDE 8

Personel

  • There is no TA at the moment.
  • My office hours are on Thursday from 5-6 PM.
  • Can also meet by appointment.
slide-9
SLIDE 9

Personel

  • There is no TA at the moment.
  • My office hours are on Thursday from 5-6 PM.
  • Can also meet by appointment.
  • Send all project questions, etc. to Piazza.
slide-10
SLIDE 10

Personel

  • There is no TA at the moment.
  • My office hours are on Thursday from 5-6 PM.
  • Can also meet by appointment.
  • Send all project questions, etc. to Piazza.
  • Likely to get other people to help you.
slide-11
SLIDE 11

Overview

slide-12
SLIDE 12

Overview

  • This is a graduate course in distributed systems.
slide-13
SLIDE 13

Overview

  • This is a graduate course in distributed systems.
  • Not assuming much prior knowledge.
slide-14
SLIDE 14

Overview

  • This is a graduate course in distributed systems.
  • Not assuming much prior knowledge.
  • Assuming prior programming experience.
slide-15
SLIDE 15

Overview

  • This is a graduate course in distributed systems.
  • Not assuming much prior knowledge.
  • Assuming prior programming experience.
  • Assuming that you can quickly pick up a new programming language.
slide-16
SLIDE 16

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
slide-17
SLIDE 17

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
  • A larger focus on classical papers in distributed systems
slide-18
SLIDE 18

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
  • A larger focus on classical papers in distributed systems
  • Class involves a fair amount of reading -- see papers on website.
slide-19
SLIDE 19

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
  • A larger focus on classical papers in distributed systems
  • Class involves a fair amount of reading -- see papers on website.
  • Skimming through proofs, etc. is fine for the reading.
slide-20
SLIDE 20

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
  • A larger focus on classical papers in distributed systems
  • Class involves a fair amount of reading -- see papers on website.
  • Skimming through proofs, etc. is fine for the reading.
  • Please do the reading though, allows you to contribute to class.
slide-21
SLIDE 21

Overview (continued)

  • This version of the class is a bit different -- my first time teaching it.
  • A larger focus on classical papers in distributed systems
  • Class involves a fair amount of reading -- see papers on website.
  • Skimming through proofs, etc. is fine for the reading.
  • Please do the reading though, allows you to contribute to class.
  • Require paper summaries to encourage reading.
slide-22
SLIDE 22

Grading

  • Paper Summaries: 20%
  • Class Participation: 7.5%
  • In class quizzes (4): 7.5%
  • Labs: 25%
  • Final Project: 40%
slide-23
SLIDE 23

Paper Summaries

  • Due at noon every Wednesday (before class).
slide-24
SLIDE 24

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
slide-25
SLIDE 25

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
slide-26
SLIDE 26

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
  • What assumptions do they make when addressing this problem?
slide-27
SLIDE 27

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
  • What assumptions do they make when addressing this problem?
  • What is the proposed solution (at a high level)?
slide-28
SLIDE 28

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
  • What assumptions do they make when addressing this problem?
  • What is the proposed solution (at a high level)?
  • How would you extend the paper?
slide-29
SLIDE 29

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
  • What assumptions do they make when addressing this problem?
  • What is the proposed solution (at a high level)?
  • How would you extend the paper?
  • Anything that was hard to understand?
slide-30
SLIDE 30

Paper Summaries

  • Due at noon every Wednesday (before class).
  • Must cover the following points for each paper:
  • What problem is being addressed?
  • What assumptions do they make when addressing this problem?
  • What is the proposed solution (at a high level)?
  • How would you extend the paper?
  • Anything that was hard to understand?
  • Try and keep the summaries succinct.
slide-31
SLIDE 31

Paper Summaries

Skip up to 6 papers without penalty

slide-32
SLIDE 32

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
slide-33
SLIDE 33

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
  • Ideally class should be entirely discussions: keeps it more entertaining.
slide-34
SLIDE 34

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
  • Ideally class should be entirely discussions: keeps it more entertaining.
  • Please introduce yourself when speaking.
slide-35
SLIDE 35

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
  • Ideally class should be entirely discussions: keeps it more entertaining.
  • Please introduce yourself when speaking.
  • Answer questions on Piazza.
slide-36
SLIDE 36

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
  • Ideally class should be entirely discussions: keeps it more entertaining.
  • Please introduce yourself when speaking.
  • Answer questions on Piazza.
  • Come to office hour and ask for participation credit.
slide-37
SLIDE 37

Class Participation

  • Speak up in class: ask questions, answer questions, express confusion.
  • Ideally class should be entirely discussions: keeps it more entertaining.
  • Please introduce yourself when speaking.
  • Answer questions on Piazza.
  • Come to office hour and ask for participation credit.
  • Reserve the right to ask you why not participate.
slide-38
SLIDE 38

In Class Quiz

  • We will have four quizzes.
slide-39
SLIDE 39

In Class Quiz

  • We will have four quizzes.
  • Held in the last 20 minutes of class.
slide-40
SLIDE 40

In Class Quiz

  • We will have four quizzes.
  • Held in the last 20 minutes of class.
  • Both multiple choice and longform answer.
slide-41
SLIDE 41

In Class Quiz

  • We will have four quizzes.
  • Held in the last 20 minutes of class.
  • Both multiple choice and longform answer.
  • Must e-mail me if you will miss a quiz.
slide-42
SLIDE 42

In Class Quiz

  • We will have four quizzes.
  • Held in the last 20 minutes of class.
  • Both multiple choice and longform answer.
  • Must e-mail me if you will miss a quiz.
  • They are marked in the class schedule.
slide-43
SLIDE 43

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
slide-44
SLIDE 44

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
slide-45
SLIDE 45

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
  • Mostly focused on getting you started.
slide-46
SLIDE 46

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
  • Mostly focused on getting you started.
  • Currently due in a week.
slide-47
SLIDE 47

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
  • Mostly focused on getting you started.
  • Currently due in a week.
  • We will have between 2--3 labs.
slide-48
SLIDE 48

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
  • Mostly focused on getting you started.
  • Currently due in a week.
  • We will have between 2--3 labs.
  • Note: I might move dates when labs are out and due around. Sorry!
slide-49
SLIDE 49

Labs

  • Traditional programming assignments in Go, using GRPC, etc.
  • The first one is out now.
  • Mostly focused on getting you started.
  • Currently due in a week.
  • We will have between 2--3 labs.
  • Note: I might move dates when labs are out and due around. Sorry!
  • Late Policy: Up to 3 days late across all labs.
slide-50
SLIDE 50

Final Project

  • You need to work on a substantial project in this class.
slide-51
SLIDE 51

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
slide-52
SLIDE 52

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
slide-53
SLIDE 53

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
  • If not, that is fine too.
slide-54
SLIDE 54

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
  • If not, that is fine too.
  • Not looking for a research project alone.
slide-55
SLIDE 55

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
  • If not, that is fine too.
  • Not looking for a research project alone.
  • Can also implement an existing paper.
slide-56
SLIDE 56

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
  • If not, that is fine too.
  • Not looking for a research project alone.
  • Can also implement an existing paper.
  • Extend an existing project (e.g., an open source project).
slide-57
SLIDE 57

Final Project

  • You need to work on a substantial project in this class.
  • If you are already involved in a research project...
  • ... it is fine to figure out a way to use it in this class.
  • If not, that is fine too.
  • Not looking for a research project alone.
  • Can also implement an existing paper.
  • Extend an existing project (e.g., an open source project).
  • Extend one of the previous labs.
slide-58
SLIDE 58

Final Project

  • The project should not be an impediment to taking this class.
slide-59
SLIDE 59

Final Project

  • The project should not be an impediment to taking this class.
  • Aim is to provide a way for students to get their hands dirty.
slide-60
SLIDE 60

Final Project

  • The project should not be an impediment to taking this class.
  • Aim is to provide a way for students to get their hands dirty.
  • If the project worries you come talk to me we will find something for you to do.
slide-61
SLIDE 61

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
slide-62
SLIDE 62

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
  • Unlikely that no one will be unhappy throughout the semester.
slide-63
SLIDE 63

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
  • Unlikely that no one will be unhappy throughout the semester.
  • If you are unhappy you can try and fix things:
slide-64
SLIDE 64

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
  • Unlikely that no one will be unhappy throughout the semester.
  • If you are unhappy you can try and fix things:
  • Complain in office hours, or over e-mail.
slide-65
SLIDE 65

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
  • Unlikely that no one will be unhappy throughout the semester.
  • If you are unhappy you can try and fix things:
  • Complain in office hours, or over e-mail.
  • Google form linked in course policy for anonymous complaints.
slide-66
SLIDE 66

Providing Feedback

  • This is my first time doing teaching a class without training wheels.
  • Unlikely that no one will be unhappy throughout the semester.
  • If you are unhappy you can try and fix things:
  • Complain in office hours, or over e-mail.
  • Google form linked in course policy for anonymous complaints.
  • Promise to listen to all complaints, not necessarily act on them.
slide-67
SLIDE 67

One last bit of Administrivia...

slide-68
SLIDE 68

Academic Honesty

  • Sadly this needs to be said.
slide-69
SLIDE 69

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
slide-70
SLIDE 70

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
  • First time teaching, first semester at NYU.
slide-71
SLIDE 71

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
  • First time teaching, first semester at NYU.
  • Really think highly of everyone here, don't shatter my illusion.
slide-72
SLIDE 72

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
  • First time teaching, first semester at NYU.
  • Really think highly of everyone here, don't shatter my illusion.
  • If you need help, need better grades for some reason ... come see me.
slide-73
SLIDE 73

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
  • First time teaching, first semester at NYU.
  • Really think highly of everyone here, don't shatter my illusion.
  • If you need help, need better grades for some reason ... come see me.
  • We can figure out a way to fix this sort of thing.
slide-74
SLIDE 74

Academic Honesty

  • Sadly this needs to be said.
  • Please don't plagiarize (projects, quizzes, whatever), and please cite your sources
  • First time teaching, first semester at NYU.
  • Really think highly of everyone here, don't shatter my illusion.
  • If you need help, need better grades for some reason ... come see me.
  • We can figure out a way to fix this sort of thing.
  • If you get caught, I will use every instrument at my disposal.
slide-75
SLIDE 75

Distributed Systems

slide-76
SLIDE 76

What is a distributed system?

slide-77
SLIDE 77

Main Characteristics (for us)

  • Comprised of several processes, each running on its own "computer"
  • For the purposes of this class node.
  • Time for processes to communicate is significant compared to an instruction.
  • Partial failures: some processes can fail while others remain alive.
  • In contrast to traditional programs where everything fails or nothing does.
slide-78
SLIDE 78

Assumptions: Message Passing

  • Only considering message passing.
  • Processes communicate by sending each other messages.

Process 0 Process 1

  • Other models (shared memory) can be shown to be equivalent.
slide-79
SLIDE 79

Assumptions: Message Passing

  • Only considering message passing.
  • Processes communicate by sending each other messages.

Process 0 Process 1 Ping

  • Other models (shared memory) can be shown to be equivalent.
slide-80
SLIDE 80

Assumptions: Message Passing

  • Only considering message passing.
  • Processes communicate by sending each other messages.

Process 0 Process 1 Ping Pong

  • Other models (shared memory) can be shown to be equivalent.
slide-81
SLIDE 81

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-82
SLIDE 82

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-83
SLIDE 83

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-84
SLIDE 84

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-85
SLIDE 85

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-86
SLIDE 86

Assumptions: Async Network

  • Asynchronous Network: Messages from different processes can be reordered.

Time P0 P1 P2

slide-87
SLIDE 87

Assumptions: Async Network

  • Asynchronous Network: Messages can be arbitrarily delayed.

Time P0 P1 P2

slide-88
SLIDE 88

Assumptions: Async Network

  • Asynchronous Network: Messages can be lost.

Time P0 P1 P2

slide-89
SLIDE 89

Assumptions: Fail Stop

  • Fail Stop: Failed processes do not send messages.

Process 0 Process 1

slide-90
SLIDE 90

Assumptions: Fail Stop

  • Fail Stop: Failed processes do not send messages.

Process 0 Process 1

slide-91
SLIDE 91

Assumptions: Fail Stop

  • Fail Stop: Failed processes do not send messages.

Process 0 Process 1 Ping

slide-92
SLIDE 92

Why distributed system?

slide-93
SLIDE 93

Three Main Reasons

slide-94
SLIDE 94

Three Main Reasons

  • Fault tolerance
slide-95
SLIDE 95

Three Main Reasons

  • Fault tolerance
  • Survive some forms of failures or bug.
slide-96
SLIDE 96

Three Main Reasons

  • Fault tolerance
  • Survive some forms of failures or bug.
  • Scalability
slide-97
SLIDE 97

Three Main Reasons

  • Fault tolerance
  • Survive some forms of failures or bug.
  • Scalability
  • Use more resources than a single computer can provide.
slide-98
SLIDE 98

Three Main Reasons

  • Fault tolerance
  • Survive some forms of failures or bug.
  • Scalability
  • Use more resources than a single computer can provide.
  • Geographic Reach
slide-99
SLIDE 99

Three Main Reasons

  • Fault tolerance
  • Survive some forms of failures or bug.
  • Scalability
  • Use more resources than a single computer can provide.
  • Geographic Reach
  • Work even when information is spread across large distances.
slide-100
SLIDE 100

How to reason about distributed systems?

slide-101
SLIDE 101

Reasoning about Systems

  • Correctness: Specify some invariants that are held (explained next).
  • Performance: How fast does it do whatever it is it does?
  • Systems view: Look at empirical measurements under various circumstances.
  • Theoretical view: Look at asymptotic number of messages.
slide-102
SLIDE 102

Safety

  • Safety: Something bad does not happen.
slide-103
SLIDE 103

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

slide-104
SLIDE 104

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

slide-105
SLIDE 105

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

This class has no exams

slide-106
SLIDE 106

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

slide-107
SLIDE 107

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

slide-108
SLIDE 108

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

slide-109
SLIDE 109

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

Exam next week

slide-110
SLIDE 110

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

Exam next week This class has no exams

slide-111
SLIDE 111

Safety

  • Safety: Something bad does not happen.

Invariant: I will never contradict a previously announced class policy.

Exam next week This class has no exams

slide-112
SLIDE 112

Liveness

  • Liveness: Eventually something good will happen.
slide-113
SLIDE 113

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-114
SLIDE 114

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-115
SLIDE 115

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-116
SLIDE 116

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-117
SLIDE 117

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-118
SLIDE 118

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-119
SLIDE 119

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-120
SLIDE 120

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-121
SLIDE 121

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-122
SLIDE 122

Liveness

  • Liveness: Eventually something good will happen.
slide-123
SLIDE 123

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-124
SLIDE 124

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-125
SLIDE 125

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-126
SLIDE 126

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-127
SLIDE 127

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-128
SLIDE 128

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-129
SLIDE 129

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-130
SLIDE 130

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-131
SLIDE 131

Liveness

  • Liveness: Eventually something good will happen.
slide-132
SLIDE 132

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-133
SLIDE 133

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-134
SLIDE 134

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-135
SLIDE 135

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-136
SLIDE 136

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-137
SLIDE 137

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-138
SLIDE 138

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-139
SLIDE 139

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-140
SLIDE 140

Liveness

  • Liveness: Eventually something good will happen.

Invariant: I will eventually return any pen that you lend me.

slide-141
SLIDE 141

Why are distributed systems hard?

slide-142
SLIDE 142

Several Problems

  • Reasoning about what happens during failures.
  • Deciding whether a node has actually failed.
  • Agreeing on an order of events.
slide-143
SLIDE 143

Several Problems

  • Reasoning about what happens during failures.
  • Deciding whether a node has actually failed.
  • Agreeing on an order of events.
slide-144
SLIDE 144

Why Event Ordering Matters

  • Natural way to think about programs and instructions.
  • For example:

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q

slide-145
SLIDE 145

Why Event Ordering Matters

  • Natural way to think about programs and instructions.
  • For example:

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this?

slide-146
SLIDE 146

Why Event Ordering Matters

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this? X Y Y X X Y

slide-147
SLIDE 147

Why Event Ordering Matters

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this? X Y Y X X Y

slide-148
SLIDE 148

Why Event Ordering Matters

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this? X Y Y X X Y

slide-149
SLIDE 149

Causally Compatible

Why Event Ordering Matters

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this? X Y Y X X Y

slide-150
SLIDE 150

Not Causally Compatible Causally Compatible

Why Event Ordering Matters

Q.send(add X) Y.send(I am in queue) msg = wait() ... Q.send(add Y) while(true) msg = wait() queue.add(msg) Process X Process Y Process Q What are the possible values of queue at the end of this? X Y Y X X Y

slide-151
SLIDE 151

How to Order Events?

Time

Q X Y

1 3 8 20 22 9

slide-152
SLIDE 152

How to Order Events?

Time

Q X Y

1 3 8 20 22 9

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-153
SLIDE 153

How to Order Events?

  • Real time provides a way to order events.

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-154
SLIDE 154

How to Order Events?

  • Real time provides a way to order events.
  • Total order: All events are ordered wrt each other.

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-155
SLIDE 155

How to Order Events?

  • Real time provides a way to order events.
  • Total order: All events are ordered wrt each other.
  • Order is compatible with causality.

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-156
SLIDE 156

How to Order Events?

  • Real time provides a way to order events.
  • Total order: All events are ordered wrt each other.
  • Order is compatible with causality.
  • Can use this ordering to ensure queue is causally compatible.

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-157
SLIDE 157

How to Order Events?

  • Real time provides a way to order events.
  • Total order: All events are ordered wrt each other.
  • Order is compatible with causality.
  • Can use this ordering to ensure queue is causally compatible.
  • How?

send( ) send( ) send( ) receive( ) receive( ) receive( )

Event Time 1 3 8 9 20 22

slide-158
SLIDE 158

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
slide-159
SLIDE 159

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
  • To use time as above, all processes need to agree on time.
slide-160
SLIDE 160

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
  • To use time as above, all processes need to agree on time.
  • Must make sure events happen at a frequency lower than clock ticks.
slide-161
SLIDE 161

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
  • To use time as above, all processes need to agree on time.
  • Must make sure events happen at a frequency lower than clock ticks.
  • Make sure clock does not diverge over time.
slide-162
SLIDE 162

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
  • To use time as above, all processes need to agree on time.
  • Must make sure events happen at a frequency lower than clock ticks.
  • Make sure clock does not diverge over time.
  • None of this happens in real life.
slide-163
SLIDE 163

How to Order Events?

  • Time sounds simple to use, but is hard to implement.
  • To use time as above, all processes need to agree on time.
  • Must make sure events happen at a frequency lower than clock ticks.
  • Make sure clock does not diverge over time.
  • None of this happens in real life.
  • Problems with both physics and engineering.
slide-164
SLIDE 164

What Do We Want?

  • Preserve causal order: related events should appear to happen in order.
slide-165
SLIDE 165

What Do We Want?

  • Preserve causal order: related events should appear to happen in order.
  • Not sure about other events: they can happen in arbitrary order.
slide-166
SLIDE 166

What Do We Want?

  • Preserve causal order: related events should appear to happen in order.
  • Not sure about other events: they can happen in arbitrary order.
  • Do not rely on a synchronized clock or a source of time.
slide-167
SLIDE 167

Why Causal Order?

  • As an aside: why causal order?
  • Idea: Causality indicates when one event could have affected another.

Q X Y

slide-168
SLIDE 168

Why Causal Order?

  • As an aside: why causal order?
  • Idea: Causality indicates when one event could have affected another.

Q X Y

slide-169
SLIDE 169

Why Causal Order?

  • As an aside: why causal order?
  • Idea: Causality indicates when one event could have affected another.

Q X Y

slide-170
SLIDE 170

Why Causal Order?

  • As an aside: why causal order?
  • Idea: Causality indicates when one event could have affected another.

Q X Y

slide-171
SLIDE 171

When Are Events Causally Linked

slide-172
SLIDE 172

When Are Events Causally Linked

  • Events in the same process

e1

e2

e3

slide-173
SLIDE 173

When Are Events Causally Linked

  • Events in the same process

e1

e2

e3

e1

  • A message send and receive

e2

slide-174
SLIDE 174

When Are Events Causally Linked

  • Events in the same process

e1

e2

e3

e1

  • A message send and receive

e2

e1

e2

e3

  • Transitive closure of the previous.
  • Why?
slide-175
SLIDE 175

Happens Before

  • A way to order causally linked events.
  • Partial order: cannot determine ordering for events that are not causally linked.
  • Assumes that we can determine an order of events for a process
  • Simple: just increment a counter whenever an event occurs.
slide-176
SLIDE 176

Happens Before

slide-177
SLIDE 177

Happens Before

e1

e2

e3

e1 → e2 e2 → e3 e1 → e3

slide-178
SLIDE 178

Happens Before

e1

e2

e3

e1 → e2 e2 → e3 e1 → e3

e1

e2

e1 → e2

slide-179
SLIDE 179

Happens Before

e1

e2

e3

e1 → e2 e2 → e3 e1 → e3

e1

e2

e1 → e2

e1

e2

e3

e1 → e2 e2 → e3 e1 → e3

slide-180
SLIDE 180

Approximating Happens Before

  • Can we approximate happens before, i.e.:
slide-181
SLIDE 181

Approximating Happens Before

  • Can we approximate happens before, i.e.:
  • Define a set of functions ci one for each process i.
slide-182
SLIDE 182

Approximating Happens Before

  • Can we approximate happens before, i.e.:
  • Define a set of functions ci one for each process i.
  • And a single function c such that
slide-183
SLIDE 183

Approximating Happens Before

  • Can we approximate happens before, i.e.:
  • Define a set of functions ci one for each process i.
  • And a single function c such that

c(e) = ci(e)

<latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit>

If event e occured at process i

slide-184
SLIDE 184

Approximating Happens Before

  • Can we approximate happens before, i.e.:
  • Define a set of functions ci one for each process i.
  • And a single function c such that

c(e) = ci(e)

<latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit>

If event e occured at process i

e0 → e1 = ⇒ c(e0) < c(e1)

<latexit sha1_base64="rAmvIhqNsE0YwVhydMyFGDP0eI0=">ACFXicbZDLSsNAFIYnXmu9RV26GSxC1ISEXThoujGZQV7gSaEyfSkHTq5MDNRSuhLuPFV3LhQxK3gzr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nlza3tn19zb8s4FRaNOax6PpEAmcRtBRTHLqJABL6HDr+6Hrqd+5BSBZHd2qcgBuSQcQCRonSkmegGdhR7DBUBEh4gcMno0dFurdIDGtaruGL3Owa5ZsepWXngR7AIqKimZ345/ZimIUSKciJlz7YS5WZEKEY5TMpOKiEhdEQG0NMYkRCkm+VXTfCxVvo4iIV+kcK5+nsiI6GU49DXnSFRQznvTcX/vF6qgs3Y1GSKojobFGQcqxiPI0I95kAqvhYA6GC6b9iOiSCUKWDLOsQ7PmTF6F9Wretun17VmlcFXGU0CE6QlVko3PUQDeoiVqIokf0jF7Rm/FkvBjvxsesdckoZg7QnzI+fwCmKZyN</latexit><latexit sha1_base64="rAmvIhqNsE0YwVhydMyFGDP0eI0=">ACFXicbZDLSsNAFIYnXmu9RV26GSxC1ISEXThoujGZQV7gSaEyfSkHTq5MDNRSuhLuPFV3LhQxK3gzrdxmahrQcGPv7/HM6c3084k8qyvo2l5ZXVtfXSRnlza3tn19zb8s4FRaNOax6PpEAmcRtBRTHLqJABL6HDr+6Hrqd+5BSBZHd2qcgBuSQcQCRonSkmegGdhR7DBUBEh4gcMno0dFurdIDGtaruGL3Owa5ZsepWXngR7AIqKimZ345/ZimIUSKciJlz7YS5WZEKEY5TMpOKiEhdEQG0NMYkRCkm+VXTfCxVvo4iIV+kcK5+nsiI6GU49DXnSFRQznvTcX/vF6qgs3Y1GSKojobFGQcqxiPI0I95kAqvhYA6GC6b9iOiSCUKWDLOsQ7PmTF6F9Wretun17VmlcFXGU0CE6QlVko3PUQDeoiVqIokf0jF7Rm/FkvBjvxsesdckoZg7QnzI+fwCmKZyN</latexit>
slide-185
SLIDE 185

Approximating Happens Before

  • Can we approximate happens before, i.e.:
  • Define a set of functions ci one for each process i.
  • And a single function c such that

c(e) = ci(e)

<latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLV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o9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit><latexit sha1_base64="WZBiuzWDXepg1mOnsvKFQ9+E03k=">AB9HicbZBNSwMxEIZn61etX1WPXoJFqJeyK4JehKIXjxXsB7RLyazbWg2uybZQin9HV48KOLVH+PNf2Pa7kFbXwg8vDPDTN4gEVwb1/12cmvrG5tb+e3Czu7e/kHx8Kih41QxrLNYxKoVUI2CS6wbgS2EoU0CgQ2g+HdrN4codI8lo9mnKAf0b7kIWfUWMtnZTwnN4R1uYVuseRW3LnIKngZlCBTrVv86vRilkYoDRNU67bnJsafUGU4EzgtdFKNCWVD2se2RUkj1P5kfvSUnFmnR8JY2ScNmbu/JyY0nocBbYzomagl2sz879aOzXhtT/hMkNSrZYFKaCmJjMEiA9rpAZMbZAmeL2VsIGVFmbE4FG4K3/OVaFxUPLfiPVyWqrdZHk4gVMogwdXUIV7qEdGDzBM7zCmzNyXpx352PRmnOymWP4I+fzB0DXkHM=</latexit>

If event e occured at process i

e0 → e1 = ⇒ c(e0) < c(e1)

<latexit sha1_base64="rAmvIhqNsE0YwVhydMyFGDP0eI0=">ACFXicbZDLSsNAFIYnXmu9RV26GSxC1ISEXThoujGZQV7gSaEyfSkHTq5MDNRSuhLuPFV3LhQxK3gzrdxmahrQcGPv7/HM6c3084k8qyvo2l5ZXVtfXSRnlza3tn19zb8s4FRaNOax6PpEAmcRtBRTHLqJABL6HDr+6Hrqd+5BSBZHd2qcgBuSQcQCRonSkmegGdhR7DBUBEh4gcMno0dFurdIDGtaruGL3Owa5ZsepWXngR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KiEhdEQG0NMYkRCkm+VXTfCxVvo4iIV+kcK5+nsiI6GU49DXnSFRQznvTcX/vF6qgs3Y1GSKojobFGQcqxiPI0I95kAqvhYA6GC6b9iOiSCUKWDLOsQ7PmTF6F9Wretun17VmlcFXGU0CE6QlVko3PUQDeoiVqIokf0jF7Rm/FkvBjvxsesdckoZg7QnzI+fwCmKZyN</latexit><latexit sha1_base64="rAmvIhqNsE0YwVhydMyFGDP0eI0=">ACFXicbZDLSsNAFIYnXmu9RV26GSxC1ISEXThoujGZQV7gSaEyfSkHTq5MDNRSuhLuPFV3LhQxK3gzrdxmahrQcGPv7/HM6c3084k8qyvo2l5ZXVtfXSRnlza3tn19zb8s4FRaNOax6PpEAmcRtBRTHLqJABL6HDr+6Hrqd+5BSBZHd2qcgBuSQcQCRonSkmegGdhR7DBUBEh4gcMno0dFurdIDGtaruGL3Owa5ZsepWXngR7AIqKimZ345/ZimIUSKciJlz7YS5WZEKEY5TMpOKiEhdEQG0NMYkRCkm+VXTfCxVvo4iIV+kcK5+nsiI6GU49DXnSFRQznvTcX/vF6qgs3Y1GSKojobFGQcqxiPI0I95kAqvhYA6GC6b9iOiSCUKWDLOsQ7PmTF6F9Wretun17VmlcFXGU0CE6QlVko3PUQDeoiVqIokf0jF7Rm/FkvBjvxsesdckoZg7QnzI+fwCmKZyN</latexit>

Lamport says yes!

slide-186
SLIDE 186

Lamport Clock

  • Each process i keeps a counter ci.

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3X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r+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-187
SLIDE 187

Lamport Clock

  • Each process i keeps a counter ci.
  • When sending a message process i increments ci.

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl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VcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-188
SLIDE 188

Lamport Clock

  • Each process i keeps a counter ci.
  • When sending a message process i increments ci.
  • Also includes new value of ci in the message.

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQ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sC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-189
SLIDE 189

Lamport Clock

  • Each process i keeps a counter ci.
  • When sending a message process i increments ci.
  • Also includes new value of ci in the message.
  • When some process j receives a message m with clock value v it:

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0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HcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-190
SLIDE 190

Lamport Clock

  • Each process i keeps a counter ci.
  • When sending a message process i increments ci.
  • Also includes new value of ci in the message.
  • When some process j receives a message m with clock value v it:

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPR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oRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-191
SLIDE 191

Lamport Clock

  • Each process i keeps a counter ci.
  • When sending a message process i increments ci.
  • Also includes new value of ci in the message.
  • When some process j receives a message m with clock value v it:
  • For all other operations (processing, etc.) process i increments ci.

cj = max(v, cj + 1)

<latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKx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6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit><latexit sha1_base64="ADPUfFU8Ao7ntgqTwAfWZ8pdUc=">AB/nicbVDLSgMxFM3UV62vUXHlJliEilJmRNCNUHTjsoJ9QDsMmTxiaZIckUy1DwV9y4UMSt3+HOvzHTzkKtBy6cnHMvufcEMaNKO86XVhYXFpeKa6W1tY3Nrfs7Z2mihKJSQNHLJLtACnCqCANTUj7VgSxANGWsHwOvNbIyIVjcSdHsfE46gvaEgx0kby7T3s38NLyNFDZXQCs8cxdI98u+xUnSngPHFzUgY56r792e1FOFEaMyQUh3XibWXIqkpZmRS6iaKxAgPUZ90DBWIE+Wl0/Un8NAoPRhG0pTQcKr+nEgRV2rMA9PJkR6ov14m/ud1Eh1eCkVcaKJwLOPwoRBHcEsC9ijkmDNxoYgLKnZFeIBkghrk1jJhOD+PXmeNE+rlN1b8/Ktas8jiLYBwegAlxwDmrgBtRBA2CQgifwAl6tR+vZerPeZ60FK5/ZBb9gfXwDktOTRw=</latexit>
slide-192
SLIDE 192

Lamport Clock (contd)

  • Then for any event e, ci(e) = ci immediately after process i has handled e.
slide-193
SLIDE 193

Lamport Clock (contd)

  • Then for any event e, ci(e) = ci immediately after process i has handled e.
  • Does this work?
slide-194
SLIDE 194

Lamport Clock (contd)

  • Then for any event e, ci(e) = ci immediately after process i has handled e.
  • Does this work?
  • What can you say about two events e0 and e1 that are not causally linked?

e0 ↛ e1

slide-195
SLIDE 195

Can we do better?

slide-196
SLIDE 196

Summary

  • One source of our problems is the use of asynchronous networks.
  • Makes it hard to maintain ordering across events.
  • Lack of ordering makes it hard to reason about programs.
  • We can use a variety of mechanisms to recover causal ordering.
  • Unclear if there are ways to recover actual (real time) ordering.
  • Almost all of the semester is about looking at this problem in different settings.
slide-197
SLIDE 197

Reminders

  • Please look through Lab 0
  • Post on Piazza, etc. if you run into trouble.
  • Read papers for next week, send me summaries.
  • E-mail me if you have any concerns about grading, the project, etc.