-
Notifications
You must be signed in to change notification settings - Fork 0
/
2014_07_22.txt
95 lines (77 loc) · 2.04 KB
/
2014_07_22.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
===============================
Ex.1
Statement is false, logical scalar clock can't say that an event e1 "happened-before" another event e2
because the definition of a logical says that
if e1 --> e2 then L(e1) < L(e2)
Statement is true if we are talking about vector clocks.
e1 --> e2 <=> L(e1) < L(e2)
===============================
Ex.2
UA, SUTO
NUA, SUTO UA WUTO
| / |
NUA WUTO |
| /
NUA,WNUTO/SNUTO
===============================
Ex.3
1 --> 2 FIFO
1 --> 2 happened-before
2 --> 4 happenede-before
Causal:
1,2,3,4
3,1,2,4
1,3,2,4
1,2,4,3
FIFO but not causal:
1,3,4,2
1,4,3,2
4,1,2,3
3,1,4,2
3,4,1,2
4,3,1,2
4,1,3,2
===============================
Ex.4
upon event <Init> do
LEFT := p_x
RIGHT := p_j
pending := empty
memstatus := ok
state := nop
grant := 0
upon event <accessMem | R> do
state := REQ_CS
trigger <FIFOSend | RIGHT, p_i, state>
trigger <FIFOSend | LEFT, P_i, state>
upon event <FIFODeliver | LEFT/RIGHT, p_i, s>
if s == REQ_CS
pending.addLast(p_i) <--- ordered list
trigger <FIFOSend | RIGHT/LEFT, p_i, s>
upon exist pending != empty && memstatus != busy do
p_j := pending.pop()
trigger <pp2pSend | RIGHT, [GRANT, p_i]>
trigger <pp2pSend | LEFT, [GRANT, p_i]>
memstatus := busy
upon event <pp2pDeliver | RIGHT/LEFT, [GRANT], p_j> do
if self == p_j then
grant := grant U {p_j}
else
trigger <pp2pSend | LEFT/RIGHT, [GRANT, p_j]
upon event <pp2pDeliver | RIGHT/LEFT, s, p_j> do
if (s == DONE) then
memstatus := ok
trigger <pp2pSend | LEFT/RIGHT, s, p_j]>
upon correct <= grant && state := REQ_CS do
executeOP(R)
state := DONE
trigger <pp2pSend | RIGHT, state, p_i>
trigger <pp2pSend | LEFT, state, p_i>
grant := 0
===============================
Ex.5
CAP theorem states that in a distributed system scenario, if a network fails occurs then it is not
possible to achieve Consistency, Availability and Partition tolerance thus one of the 3 must be
dropped. Since we are in a distributed system scenario, we cannot drop Partition Tolerance, thus
the choose must be among the two.
AP == Amazon Dynamo