Time and coordination (5) Flashcards

1
Q

What relationship does events that are not related in the “happened- before” relation have?

A

They are concurrent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do we use logical clocks?

A

They are a way for processes to be able to agree about the order events have happened in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where in the architecture are logical clocks located?

A

Between app- layer and the network. i.e. inside the middleware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the two rules for logical clocks?

A

LC1:
Each process must increment its logical clock with 1 before an event on the process is applied.

LC2:
When a process sends a message it piggybacks its own logical clock on the message. The receiver sets its own logical clock to the biggest of the two and applies LC1 before it timestamps the recv event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What info does vector clocks give us that logical clocks can not?

A

Logical clocks capture dependencies as a consequence of message exchange but not causality.
Vector clocks can catch causality as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 4 rules for vector clocks?

A

Each process p maintans a vector clock Vp of size N.
A timestamp for event a at process p: Vp(a)
VC1:
Vp[j] is initially 0 for all nodes j.
VC2:
p increments Vp[p] with 1 before each event timestamp.
VC3:
if p sends a message m, it piggybacks Vp on m.
VC4:
If (m, ts) is received by q, q computes Vq[j] to max(Vq[j], ts[j] for all j. Then it applies VC2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How is the (local) history of a process modelled?

A

A history for a process p is a sequence events and corresponding state at p.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is the global history of a system defined?

A

A collection of all local histories, on from each process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a cut of a global state?

A

A union of prefixes from some processes’ local histories. i.e. that we cut all events in the global history from a certain point to reason about it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a consistent cut?

A

If an event e is included in the cut, and an event f -> e, then f must be in the cut as well for it to be consistent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a linearisation?

A

A linearisation is an arbitrary extension of a partial ordering of events in global history. (basically that you also give an ordering to events in the global history that are concurrent)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does it mean that state S’ is reachable from state S?

A

State S’ is reachable from state S if there exists a linearization that starts in S and ends in S’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is stable property?

A

If something is true in S, it is true in any state reachable from S.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is safety property?

A

If something is true in any state reachable from S0(initial state) it has the safety property.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is liveness property?

A

In any linearisation there is a state reachable from S0 where it is true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the steps in the procedure for starting a snapshot?

A

P logs its own state

P sends a marker over all outgoing links.

P starts to log incoming messages on all input channels

17
Q

What are the steps in the procedure for when process P receives a marker over channel c in the snapshot algorithm?

A

If p has not recorded its state:
- P records state
- P forwards the marker over alle out channels
- P sets the state of c to empty
- p starts to record incoming msgs on all other in channels
Else:
- P records the state of c to be all msgs received on c since P recorded its state

18
Q

What is “the marker sending rule” in the snapshot algorithm?

A

Processes must send a marker after they have recorded their state, but before they send any other message.

19
Q

What is “the marker- receiveing rule” in the snapshot algorithm?

A

A process that has not recorded its state must do so.

20
Q

What are the use cases of the snapshot algorithm?

A

checkpointing, i.e. making checkpoint that the application can roll back to after failure.

Debugging.

Deadlock and termination detection.

21
Q

What are the requirements of a distributed consensus algorithm?

A

Agreement: No two non-fault processes decide on different values.

Termination: If there are non- faulty processes, at least one of them decides.

Integrity(validity/non- triviality): If all non- faulty processes start with the same initial value v, then v is the only possible decision value for a non- faulty process.

22
Q

What are the requirements for a reliable multicast algorithm?

A

Termination: Every non-faulty process delivers a message.

Agreement: No two non-faulty processes deliver different messages

Validity: no spurious messages

Integrity: If the sender is non-faulty, it delivers the message it sent

23
Q

What are the requirements for a mutual exclusion algorithm?

A

Safety: At most one process can be in critical section at at a time.

Liveness(avoid starvation): Each request to entry/exit the critical section eventually succeeds.

Ordering: Entrance to the CS must observe the “happened- before” relation. (if f -> e then f should get in before e)

24
Q

Which mutual exclusion algorithms have we gone through?

A

Central server

Ring- based

Ricart & Agrawala algorithm(based on logical clocks)

25
Q

Which distributed leader election algorithms have we gone through?

A

The bully algorithm

Ring- based algorithm

(paxos in later lecture)

26
Q

What are the requirements for a distributed leader election algorithm?

A

Safety: Max one node will be leader at a time
Liveness: A leader will be elected.

27
Q

Explain Ricart and Agrawala algorithm for mutex

A

Orka ikke skrive inne hele sjekk notes

28
Q

Forklar the snapshot algorithm

A

P skal sende markør:

P lagrer egen lokal state, så sender den en markør gjennom på kanaler før den kan sende vanlige meldinger igjen.

Når Q mottar markør på kanal C1:

Hvis Q ikke har lagret sin lokale state.(dvs. den ikke har motatt markør tidligere):
- Lagre state på inkommende kanal som tom.
- Følg reglene for å sende markør.
Hvis Q allerede har lagret sin state.(den har motatt en markør tidligere):
- Lagre state for C som sekvensen av meldinger motatt langs C1 etter lokal state ble lagret og før Q mottok foreløpig markør.

29
Q

Forklar the bully algorithm

A

Prosessen som oppdager at coordinator har feilet sender election melding til prosessene som har større identifikator enn seg selv.
Den venter på ANSWER melding:
1. Om ingen svarer, setter prosessen seg selv til leder og sender COORDINATOR melding til alle prosesser med mindre identifikator.
2. Hvis en ANSWER melding blir motatt lar den prosessen som sendte ANSWER ta over og venter på COORDINATOR melding. Hvis ingen melding blir motatt starter den en ny election.

Hvis en prosess mottar en COORDINATOR melding, lagrer den identifikator i meldingen som ny coordinator.

Hvis en prosess mottar en ELECTION melding, sender den tilbake en answer melding og tar over ved å starte ny election.

Når en prosess recovers eller joiner systemet starter den ny election. Hvis den har størst identifikator gjør den seg selv til leder og annonserer det, selv om det allerede finnes en fungerende leder.