0% found this document useful (0 votes)
9 views12 pages

DC (Unit 3)

The document discusses distributed mutual exclusion algorithms and deadlock detection in distributed systems, covering key algorithms such as Lamport's, Ricart-Agrawala's, and token-based algorithms like Suzuki-Kasami's. It outlines the requirements for mutual exclusion, including freedom from deadlocks and starvation, as well as performance metrics like message complexity and response time. Additionally, it details the Chandy-Misra-Haas algorithm for deadlock detection in both AND and OR models.

Uploaded by

maniputu11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

DC (Unit 3)

The document discusses distributed mutual exclusion algorithms and deadlock detection in distributed systems, covering key algorithms such as Lamport's, Ricart-Agrawala's, and token-based algorithms like Suzuki-Kasami's. It outlines the requirements for mutual exclusion, including freedom from deadlocks and starvation, as well as performance metrics like message complexity and response time. Additionally, it details the Chandy-Misra-Haas algorithm for deadlock detection in both AND and OR models.

Uploaded by

maniputu11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
3 Distributed Mutex and Deadlock Syllabus Distributed Mutual exclusion Algorithms : Introduction - Preliminaries - Lamport's algorithm - Ricart-Agrawala's Algorithm - Token-Based Algorithms - Suzuki-Kasami's Broadcast Algorithm : Deadlock Detection in Distributed Systems : Introduction - System Model - Preliminaries - Models of Deadlocks - Chandy-Misra-Haas Algorithm for the AND model and OR Model. Contents 3.1. Distributed Mutual Exclusion Algorithms : Introduction 3.2. Preliminaries 3.3 Lamport's algorithm 3.4 Ricart-Agrawala's Algorithm . . May-22, Dec.-22, 3.5 Token-Based Algorithms 7 Dec-22) 3.6 Deadlock Detection in Distributed Systems : Introduction 3.7. System Model 3.8 Preliminaries : Deadlock Handling Strategies 3.9 Models of Deadlocks 3.10 Chandy-Misra-Haas Algorithm for the AND Model 3.11 Chandy-Misra-Haas Algorithm for the OR Mode! 3.12 Two Marks Questions with Answers = —— B-h) a — "9 Des amated comping tributed Mutual Exclusion Algorithms : Introduction 1 concurrent processes make a serialized a, wires that the actions performed by a ess SEE on ‘Mutual exclusion ensures that In a distributed system neither order to exclu exclusively on message pass and no complete knowledge of the Makes sure that concurrent process access shared resources g data in a serialized way. If a process, say Pi, is ex tS critical section then no other processes can be executing in thei bes nora Tocal kernel ean be uy ox has t0 be baa ‘The code executed in prep: tion for entering the critical section + The code to be protected from concurrent execution it section : The code executed upon leaving the ci Remainder section : The rest of the code Each process cycles through these sections in the order : Ea EEI system model * Distributed mutual exclusion a delays and incomplete knowled; ‘System model section igorithms must deal with unpredictable messigt ie of the systein state. ‘The system consists of N sites, SS, ‘anning on each site. The proces at site §, arama aticn ty have several ie at a time, Sy- We assume that a single process § 4s denoted by pi. Site may in one of the th wee 1. Requesting CS “tates 2. Executing CS 3. Neither request SHENG MOF executing requests for CS Teche PuBUCATION? ap apm bptea pisnouled Computing a e Distibuted Mutex and Deselock classification of Mutual Exclusion «These algorithms are divided into two classes : 1, Non-token based : Require multiple rounds of message exchanges states to stabilize 2. Token based : Permission passes around from one site to another, Site is allowed to enter its critical section if it possesses the token and it continues to hhold the token until the execution of the critical section is over. EEEY Requirement of Mutual Exclusion 1. Freedom from deadlocks : Two or more sites should not endlesly wait for message that will never arrive 2. Freedom from starvation: A site should not wait indefinitely while other sits repeatedly access the CS 5, Strict fairness + Requests are served in the (ogc) order in which they ative, 4, Fault tolerance : An algorithm should be able to detect and recover from failures. EEE] Performance Metrics 1. Message complexity : The number of messages required per CS execution by @ fon delay + After a site leaves the CS, it i the Hime required before enters the CS. Response ime: The time iter a ques after its request messages have been sent 0 Haare mt atwhh be sytem cus gu ee system throughput = 1(SD¥E) where SD is the synchronization delay and E i the average critical section ‘execution time. Fig, 32.1 shovrs the synchronization del Synchronization delay (sf): A leaves ~ B enters Response time : A reque' ee time unit = 1 / (SD + &) where E is Throughput + CS reque average execution time of CS. pLscaTiOns® an epi iontese 1 waits for its CS execution to be over TECHNICAL narra Company toe 088 C5 i ytvoniston tony Fig. 22.1 Synchronization delay Fig, 222 Response time EEE Lamport's algorithm ‘+ Permission from all process ample of nonilen biel alone Raicourol-Carvalho ete, . “ Let Ri be the request set of Permission when it wants + Lamport, Ricart- Agarwala, Each site Si keeps Me Si keeps a request queue of requests ordered by logical timestamp pwrctedcoreey ans varied Mies and Doak 25 aes ste nd Decor Requesting the critical section + Send a REQUES! tw each other site, and place in the request queue. «When Sj teceives the REQUEST(Ci places the REQUEST in the request queue. retums a timestamped REPLY to Si and Conditions for entering CS tthe top of the request queue. site Si receives site S's request wi 5) does not have any rithm requires between 3(N ~ 1) and With this optimization, Lamport 2(N ~ 1) messages per CS execution. Fig. 33:1 shows the optimization of Lamp. TE SHMICAL PUBLICATIONS? . an up trastfr oma coma Ramanan it ro Distributed Mutox and atedconpuig Nea pistiéuted Computing Logical timestamp = 2 (2,1) Process = et step 3: Site S2 exits section stituted Mutox nd Deadlock ‘and Sends RELEASE messages, st Fig. 33.4 (a) ‘Stop 2 : Site $2 enters the critical section. leaves ‘tical section Step 4: Site SI enters critical section St enters *. citical section“, (2) st 2al12| 24 Ey é 2] 4 , sa i fiz] fiz laa ay Ise critical section Fig. 3.3.4 (by Fig. 3.3.1 (8) Lamport evaluation * Deadlock : processes do not wait vee Ce neat Lin See Rana + a0 upstnus for knowiedge a oer of logical clock, which is fair 2 etna eonmwcan pusicaTions® =e seins 38 DhsiPuted Mutex ang | Om, average message Inency) 's Algorithm process jers are compare! to order ‘The process that 9 the critical section : 1, Request when Si wants 10 REQUEST message to all ste. ter the critical section, it broadcast timestamped > When a process receives a REQUEST message, it may be in one of thre states Case 41: The receiver isnot in se 1: Th * interested inthe critical section, send reply (OK) to sender. Case 2: The rctver isin the efit Jocal queue of request (Case 3: The receiver also w ‘ The so wants to ente the the receiver compa itthas sent out. The earliest tegen (OK) to sender the ree not reply Instead ‘ection; do not reply and add the request 0¢ 3. When site Si enters the s cl section after request set Merit has received REPLY message from! TECHNICAL PLBLICATONS® gp vou, “Ptst for knowiedge i ‘psinbuted Computing 3-9 Cistnbuted Mutex and Deadlock pao Comes —_____3-9 ___isirbuted Mux and Deacook leasing the critical section : 4. When site Si exits the CS, it sends RELEASE(i) messages to all sites in its request set Ri. 5, When a site Sj receives the RELEASE() message from message to the next site waiting in the queue and deletes queue. If the queue is empty, then the site updates its state to reflect that the site hhas not sent out any REPLY message. Once imp! + Fig. 3. te Si has received a REPLY message from a site §}, the authorization in this message remains valid until Si sends a REPLY message to 5) shows operation of Ricart-Agrawal gorithm, Stop 1: Site SI and $2 are making request for critical section. Fig. 3.4.1 (0) Step 2 : Site $2 enters the critical section. st 2 2 S ‘S2enters i | Sea eon Fig. 344 (0) TECHNICAL CC O00 SS ————— eR Deseraased WAses 07d Deacticy, y messages to SI. Seep 3: Sac Seu the CS an sents a REPL Fig 341 (0) L Stes ib the Rice Agramels dgortio te -— ftSeetony, seriion the critic! section is in increasing ¢ section is accessed ng order 2 Exples Rite Arrests Alpert 22 ox cape Ea mS -—_—_ a EE] Token-Based Algorithms a even In nontoken based af ot any concept of sharing token for Igorithm, there is no token Tecreecet PusucaTions® - 9 ptt fer inonedgn Token based algorithms are algorithm. SurukiKacami algorithm and Raymonds. tree (ital section) if it has a — maintains a Sequence number (equa i) MA & Hoke. Evens proses BERI surukiasamis Broadcast Algorithm Logical token representing the access right to the shared e recurs is passed in a regulated fashion among the process: whoever holds the token is allowed t0 enter the critical section. + A unique token is shared among all sites. This means a sequence number is wed instead of a timestamp. «Sites increment its sequence number every time it requests the token. This means, issues of liveness (deadlock-freedom, starvation) are more interesting ‘+ To enter CS, a site broadcasts its REQUEST message to all other sites. + Upon receiving a REQUEST message, a site that has the token sends the token to the requesting site only if this site is not in CS. If it isin CS, it sends the token only after it has exited the CS. ‘+ A site can repeatedly enter CS as long as it holds the token and there are no pending requests from other sites. Major Design Issues + No RELEASE/REPLY messages as in assertion based protocols + Each site needs to be able to distinguish outdated REQUEST messages from current REQUEST messages (outstanding requests) «The site with the token needs to know which site to send the token next, Important Data Structures + The token consists of Q a queue of requesting sites, Array of integers, LN[I-NI. Where LNG] is the sequence number of the request that ste Sj executed most recently and N is the numberof sites and LN keeps track of the atest request that each site has executed. *- A site Si keeps an array of integers RNi[1_N] where RNif] is the langest sequence umber received so far from Sj. A REQUEST(.n) indicates that site S is requesting for CS with n as its sequence number. TEcraICAL PUSLICATIONS® - an pti fy owt

You might also like