UNIT -2 of distrubuted system
UNIT -2 of distrubuted system
Vijay Katta 1
Vijay Katta 2
1
11-10-2024
Vijay Katta 3
Vijay Katta 4
2
11-10-2024
Vijay Katta 5
Mutual Exclusion
algorithms
Centralized Distributed
algorithms Algorithms
Controlled
Contention Based Algorithms
Non Token based Algorithms (Token based
algorithms)
Timestamp prioritized
Tree Structure
schemes
Ring Structure
Vijay Katta 6
3
11-10-2024
Vijay Katta 7
Advantages
➢ Fair algorithm, grants in the order of requests
➢ The scheme is easy to implement
➢ Scheme can be used for general resource allocation
Critical Question: When there is no reply, does this mean that the
coordinator is “dead” or just busy?
Shortcomings
➢ Single point of failure. No fault tolerance
➢ Confusion between No-reply and permission denied
➢ Performance bottleneck of single coordinator in a large system
Vijay Katta 8
4
11-10-2024
Vijay Katta 9
Vijay Katta 10
5
11-10-2024
Vijay Katta 11
Vijay Katta 12
6
11-10-2024
➢ System Model
➢ The system consists of N sites, (S1, S2, ..., SN ).
Vijay Katta 13
7
11-10-2024
Vijay Katta 15
➢ Response time:
➢ System throughput:
Vijay Katta 16
8
11-10-2024
Vijay Katta 17
Vijay Katta 18
9
11-10-2024
➢ system throughput=1/(SD+E)
➢ where SD is the synchronization delay and
➢ E is the average critical section execution
time.
Vijay Katta 19
10
11-10-2024
1) Lamport ME Algorithm
2) The Ricart Agrawala Algorithm
3) Roucairol -Carvalho Algorithm
4) MAEKAWA’s Algorithm
5) Generalized Non token based algorithm
Vijay Katta 21
11
11-10-2024
12
11-10-2024
Vijay Katta 25
Vijay Katta 26
13
11-10-2024
Reply messages:
P2
|(2. 2)| Request Queue
|(2.2) (3. 1)|
at P2
P3
Vijay Katta 27
P2
(2. 2) (2.2) (3. 1) Release
Message
P3
Vijay Katta 28
14
11-10-2024
Vijay Katta 29
Vijay Katta 30
15
11-10-2024
Vijay Katta 31
Vijay Katta 32
16
11-10-2024
Vijay Katta 33
Vijay Katta 34
17
11-10-2024
Vijay Katta 35
RSi RSj
RSx RSk
Vijay Katta 36
18
11-10-2024
Vijay Katta 37
Vijay Katta 38
19
11-10-2024
Vijay Katta 39
20
11-10-2024
Vijay Katta 41
21
11-10-2024
Vijay Katta 44
22
11-10-2024
Vijay Katta 46
23
11-10-2024
❖ Each edge is pointed towards the site(or root of the tree) having token
REQUEST_Q HOLDER1 = 1
1 3
REQUEST_Q HOLDER3 = 1
2 3 8
8 REQUEST_Q HOLDER8 = 3
4 5 6 7 8
Vijay Katta 48
24
11-10-2024
Vijay Katta 50
25
11-10-2024
Vijay Katta 51
8. In this case, the site delete the top entry from its
request_q and enter the CS.
Vijay Katta 52
26
11-10-2024
Vijay Katta 53
P8 requests entry to CS
And P1 is in CS
New HOLDER1 = 3
1 3 1 1
New HOLDER3 = 8
2 3 8 2 3 8 2 3
4 5 6 7 8 8 4 5 6 7 8 8 4 5 6 7 8 New HOLDER8 = 8
Vijay Katta 54
27
11-10-2024
4 5 7 8 4 5 6 7 8 8 4 5 6 7 8
6
6 3
2. Req. by P8 5. P1 passes T to P3 8. Req. by P7
1 3 1 2 1 2
1, 7
2 2 3 8, 6,1 2 2 3
2 3 8
4 5 6 7 8 8 4 5 6 7 8
4 5 6 7 8 8 3
6 7
3. Req. by P2 6. P3 passes T to P8 9. P6 passes T to P3, to P1
1 3, 2 1 2 1 2,3
2 2 3 8 2 2 3 6,1 2 2 3 7
4 5 6 7 8 8 4 5 6 7 8 3 4 5 6 7 8
6 7
Vijay Katta 56
28
11-10-2024
Vijay Katta 57
Bandwidth?
Client delay?
Synchronization delay?
29
11-10-2024
Vijay Katta 59
0 0 0 0 0 RN1
RN2 0 0 0 0 0
1 2 3 4 5
1 2 3 4 5
n=1 S1
S2 n=2
0 0 0 0 0 LN
1 2 3 4 5 Token at Site
S1
Q { } (empty) S3 n=3
RN3 0 0 0 0 0
n=5 S5 1 2 3 4 5
n=4
RN5 0 0 0 0 0
S4 0 0 0 0 0 RN4
1 2 3 4 5
1 2 3 4 5
30
11-10-2024
31
11-10-2024
0 1 0 0 0 RN1
RN2 0 1 0 0 0
1 2 3 4 5
REQUEST(2,1) 1 2 3 4 5
n=1 S1
S2 n=2
REQUEST(2,1)
0 0 0 0 0 LN
1 2 3 4 5 Token at Site
S1
Q {S2 } [Inserted only when S1 leave CS] S3
RN3 0 1 0 0 0
n=5 S5 REQUEST(2,1) 1 2 3 4 5
REQUEST(2,1)
n=4
0 1 0 0 0
S4 0 1 0 0 0 RN4
1 2 3 4 5
1 2 3 4 5
0 1 0 0 0 RN1
RN2 0 1 0 0 0
1 2 3 4 5
1 2 3 4 5
n=1 S1
S2 n=2
0 LN0 0 0 0 LN
Token at Site S2
1 2 3 4 5
Q{s2} S3
RN3 0 1 0 0 0
n=5 S5 1 2 3 4 5
n=4
0 1 0 0 0
S4 0 1 0 0 0 RN4
1 2 3 4 5
1 2 3 4 5
32
11-10-2024
0 1 0 0 0 RN1
RN2 0 1 0 0 0
1 2 3 4 5
1 2 3 4 5
n=1 S1
S2 n=2
0 LN1 0 0 0 LN
Token at Site S2
1 2 3 4 5
Q{} S3
RN3 0 1 0 0 0
n=5 S5 1 2 3 4 5
n=4
0 1 0 0 0
S4 0 1 0 0 0 RN4
1 2 3 4 5
1 2 3 4 5
33
11-10-2024
34
11-10-2024
Vijay Katta 69
Vijay Katta 70
35