Source: Distributed Mutual Exclusion slides. Past-paper questions appear beside the relevant topics.

1. Problem and requirements

  • A critical section (CS) accesses a shared resource. Safety requires at most one process in it at once.

  • Liveness requires progress without deadlock or starvation; fairness concerns the order in which requests are served.

  • Distributed processes coordinate through messages rather than a shared local semaphore.

  • A token-based protocol grants access to the unique token holder; a permission-based protocol gathers replies; a quorum-based protocol asks an intersecting subset of sites.

  • Message complexity counts messages per CS execution. Synchronization delay is the interval from one exit to the next entry. The slides express saturated throughput as , with synchronization delay and average CS duration .

  • A site can be idle, requesting, or executing the critical section. In token algorithms an idle site may still hold the token. A requester waits for its current request to be resolved; further local requests can be queued.

PYQ — Semester paper printed 2023 (file named 2022), CO3

Original question from the question paper

What are the performance metrics of mutual exclusion?
Answer

7 marks

  1. Message complexity: number of messages exchanged for one CS execution; fewer messages reduce communication overhead.
  2. Synchronization delay: time between one process exiting the CS and the next waiting process entering it.
  3. Response time: time from sending the request until the requested CS execution finishes; it includes waiting and execution.
  4. Throughput: number of CS executions completed per unit time. Under continuous demand, the slide model gives , where is synchronization delay and is average CS duration.
  5. Low-load performance: evaluates the algorithm when few requests compete, so token acquisition or permission delay dominates.
  6. High-load performance: evaluates the algorithm when requests are continuously waiting; queueing and synchronization delays become significant.
  7. For example, Lamport’s basic algorithm requires messages per CS and has synchronization delay in the slide model.

2. Lamport’s algorithm

  • Each site keeps a request queue ordered by logical timestamp, breaking ties by process ID. Channels are FIFO in the slide model.
  1. A requester broadcasts REQUEST and places its request in its own queue.
  2. A receiver adds the request to its queue and returns a timestamped REPLY.
  3. The requester enters when its request is at the head of its queue and it has received a later timestamped message from every other site.
  4. On exit it removes its request and broadcasts RELEASE; receivers remove it from their queues.
  • The same timestamp order prevents two sites from both seeing their requests as earliest while satisfying the entry conditions.
  • Cost: messages per CS execution; synchronization delay in the slide model. The slide also describes an optimization that can omit some replies, giving between and messages.

PYQ — Semester 2025, CO3: Lamport’s algorithm

Original question from the question paper

Describe Lamport’s algorithm, illustrate it for four nodes, and state its limitations and optimization.
Answer
  1. Principle: every site maintains a request queue ordered by Lamport timestamp; process ID breaks ties. The slide model assumes FIFO channels.
  2. Request: a requester adds its timestamped request to its own queue and broadcasts REQUEST to all other sites.
  3. Reply: each receiver inserts the request into its queue and sends a timestamped REPLY.
  4. Entry: the requester enters only when its request is first in its own queue and it has received a later timestamped message from every other site.
  5. Release: on exit it removes its request and broadcasts RELEASE; each receiver removes that request from its queue.
  6. Four-site illustration: if requests before in timestamp order, queues place first. enters after the later-message condition holds; enters after releases and its own conditions hold. The detailed sequence follows below.
  7. Cost: for four sites, each execution uses 3 requests, 3 replies and 3 releases: messages.
  8. Limitations: all other sites participate; communication cost increases with ; a failed or unresponsive site can block progress; the slide version requires FIFO channels.
  9. Optimization: if a peer has already sent a later timestamped REQUEST, it can sometimes omit a separate REPLY: that request serves as the required later message. The slide gives to messages.

Worked example: two competing requests among four sites

Assume and independently issue requests and ; and do not request. All channels are FIFO and all four sites eventually receive both requests.

  1. Each requester inserts its own request and sends three REQUEST messages. Each receiving site inserts the request in timestamp order and replies. Arrival orders may differ, but once both requests arrive each queue has .
  2. Once has a later message from each of , its request is at its queue head and it enters. cannot enter while ‘s earlier request is at its queue head.
  3. exits, removes its own request and sends three RELEASE messages. Each receiver removes ; at the remaining request becomes head.
  4. After has received the required later message from every peer, it enters, exits and broadcasts its own RELEASE. In the basic algorithm each execution costs nine messages, so these two executions use 18.
sequenceDiagram participant P1 participant P2 participant P3 participant P4 Note over P1,P2: Both broadcasts are sent before either receives the other Note over P1,P4: Arrows below show request deliveries P2->>P1: Deliver REQUEST (2, P2) P2->>P3: Deliver REQUEST (2, P2) P2->>P4: Deliver REQUEST (2, P2) P1->>P2: Deliver REQUEST (1, P1) P1->>P3: Deliver REQUEST (1, P1) P1->>P4: Deliver REQUEST (1, P1) Note over P1,P4: Peers queue requests and send replies Note over P1: P1 enters and exits CS P1->>P2: RELEASE P1->>P3: RELEASE P1->>P4: RELEASE Note over P2: P2 enters after entry conditions hold

PYQ — Semester 2025, CO3

Original question from the question paper

Prove that Lamport’s mutual exclusion algorithm obeys fairness.
Answer
  1. Fairness claim: pending requests are served in increasing order of the pair .
  2. Assume has an earlier request than , but enters while ‘s earlier request remains pending.
  3. Before entry, must have a later timestamped message from every other site, including .
  4. Because the earlier request was sent before ‘s later message and the channel is FIFO, has received ‘s request before that later message.
  5. places ‘s request ahead of its own in its ordered queue. Hence ‘s request cannot be at the head while ‘s remains pending.
  6. This contradicts the entry condition. Thus earlier pending requests are served first; eventual service also assumes reliable delivery, continuing processes and finite CS executions.
  7. This is logical timestamp order, not necessarily the order of physical arrival times.

PYQ — CT2 2026, Q2: simultaneous requests and a delayed release

Original CT2 2026 Q2 showing all three timestamps and four parts

In Lamport’s algorithm, sites simultaneously request the critical section with pairs , and . Find their entry order, explain how ties are resolved, describe the effect of a delayed RELEASE from , and state the safety and liveness requirements. (10 marks)
Solution
  1. Compare the timestamp first. comes first. At timestamp , compare site IDs, so precedes . Each site orders requests by these same pairs and checks the queue-head and later-message conditions before entering.
  2. On exit, broadcasts RELEASE. Each recipient keeps in its local queue until it receives that RELEASE, which blocks its own entry in the meantime. If receives it first and its other entry conditions hold, it can enter. still needs the releases from both earlier sites and its own later-message condition.
  3. Safety: at most one site is in the critical section. A delayed release postpones entry while preserving this property. Liveness: pending requests eventually enter, assuming eventual message delivery, continuing sites and finite critical sections. A release that never arrives can block progress.

Result: .

3. Ricart–Agrawala

  • The slide model assumes FIFO channels. Each site tracks deferred replies in an array RD: set RD[j] when deferring site , and clear it after sending the deferred reply.
  1. Broadcast a timestamped REQUEST to all other sites.
  2. A receiver replies immediately if it is idle or the incoming request has priority over its own pending request. Otherwise it defers the reply, including while it is in the CS.
  3. Enter after receiving a REPLY from every other site.
  4. On exit, send all deferred replies. There is no separate release broadcast.
  • Timestamp plus process ID gives an unambiguous priority order. A higher-priority requester withholds permission from a conflicting lower-priority request until it exits.
  • Cost: messages; synchronization delay under the slide model.

PYQ — Semester 2021, CO3(b)

Original question from the question paper

With three processes, and request the CS with timestamps 47 and 32 respectively, while is idle. List the events until both finish.
Answer
  1. Assume both requests are outstanding before either requester receives the other’s request. broadcasts REQUEST(47, P1) to ; broadcasts REQUEST(32, P2) to .
  2. is idle, so it sends a REPLY to both and .
  3. compares 32 with 47: has priority, so sends REPLY to .
  4. compares 47 with 32: its own request has priority, so it defers the reply to .
  5. After receiving replies from both peers, enters the CS. must wait for ‘s reply.
  6. finishes and sends the deferred REPLY to .
  7. Once has both replies, it enters and finishes the CS. Thus the execution order is followed by .
  8. Each execution uses messages, so the two requests together use 8 messages.
sequenceDiagram participant P1 participant P2 participant P3 P1->>P2: REQUEST 47 P2->>P1: REQUEST 32 P1->>P3: REQUEST 47 P2->>P3: REQUEST 32 P1->>P2: REPLY P3->>P1: REPLY P3->>P2: REPLY Note over P2: Enter and exit CS P2->>P1: Deferred REPLY Note over P1: Enter and exit CS

PYQ — Semester 2024, CO3: clocks

Original question from the question paper

Explain how clocks affect mutual exclusion.
Answer

7 marks

  1. Each site maintains a Lamport logical clock and increments it for local events, including issuing a request.
  2. A message carries the sender’s logical timestamp; on receipt, the receiver updates its clock to exceed both its current value and the received timestamp.
  3. A CS request is assigned a timestamp when issued. The pair gives requests a definite priority order.
  4. A smaller timestamp has higher priority; the process ID resolves equal timestamps.
  5. In Lamport’s algorithm, every site orders its request queue using this pair. Entry also requires a later timestamped message from every other site.
  6. In Ricart–Agrawala, a requester replies immediately to a higher-priority competing request and otherwise defers its reply until it exits.
  7. Example: requests and are competing; has priority. Logical clocks order events and do not require synchronized physical clocks.

4. Quorums and Maekawa

  • A quorum is a request set; any two quorums intersect. A voter grants only one conflicting request at a time, so a shared voter prevents both requesters from collecting all permissions.

  • A coterie is a family of pairwise-intersecting quorums. Minimality excludes one quorum containing another; it improves efficiency rather than being the safety argument.

  • Maekawa requests permission from every member of its quorum, enters after all reply, then releases all votes. Quorum size is approximately , giving about messages and synchronization delay in the slide model.

  • Basic Maekawa can deadlock: several processes hold different partial sets of votes while waiting for each other. The modified algorithm uses FAILED, INQUIRE, and YIELD messages so a lower-priority request can return a vote needed by a higher-priority one.

  • In the symmetric construction, each quorum has members, contains its own requester, and each site appears in quorums. Self-permission does not require a network message, so exact counts depend on whether it is counted.

  • A voter that has granted a vote sends FAILED to a lower-priority waiting requester; if a higher-priority request arrives, it sends INQUIRE to the current grantee. A grantee that cannot complete because it received FAILED (or has yielded and not regained a grant) can YIELD. The voter queues the returned request and grants the highest-priority waiting request.

  • The slides also present a strong global FIFO assumption as an alternative way to avoid the deadlock: every site receives requests in increasing timestamp order. Ordinary FIFO per channel alone does not guarantee this.

  • The slides give up to messages with deadlock-handling messages. Basic Maekawa’s deadlock is a liveness failure, even though intersecting quorums preserve mutual-exclusion safety.

assets/slide-figures/maekawa-quorums.png

Slide example: intersecting quorums

Every pair of request sets shares at least one voter; that shared voter cannot grant both requests simultaneously.

  • In the slide’s concrete deadlock, , and . Voters 0 and 2 grant requester 0; voters 1 and 3 grant requester 1; voters 4 and 5 grant requester 2. Requester 0 waits for voter 1, requester 1 waits for voter 5, and requester 2 waits for voter 2: a cycle of held votes.

PYQ — CT1 2024, Q2(a)

Original question from the question paper

Ricart–Agrawala accesses the CS in increasing timestamp order. Does the same hold in basic Maekawa?
Answer

2 marks

  1. No. A Maekawa voter grants its vote based on requests it has received; it cannot know that an earlier-timestamped request is still in transit.
  2. It may already grant a later request, allowing that request to proceed first. Thus basic Maekawa does not guarantee global timestamp order.

PYQ — CT1 2024, Q2(b)

Original question from the question paper

Give a situation where basic Maekawa’s algorithm can deadlock.
Answer

3 marks

  1. Let , and . Suppose 0 holds votes 0 and 2; 1 holds votes 1 and 3; 2 holds votes 4 and 5.
  2. Requester 0 needs voter 1, requester 1 needs voter 5, and requester 2 needs voter 2. Thus 0 waits for 1, 1 waits for 2 and 2 waits for 0.
  3. None has all its votes, so none can enter and release its votes: the circular wait is a deadlock.
flowchart LR P0[Requester 0] -->|waits for| P1[Requester 1] P1 -->|waits for| P2[Requester 2] P2 -->|waits for| P0

5. Suzuki–Kasami token algorithm

  • One token exists. A site enters its CS only while holding it.
  • Each site maintains request sequence numbers RN; the token maintains last-served numbers LN and a queue of waiting sites.
  • is the largest sequence number from known at ; on the token is the sequence number of ‘s most recently served request. If , has an outstanding request in the one-request-per-site model.
  • A requester without the token increments its own sequence number and broadcasts REQUEST. Other sites update their record; an idle token holder may forward the token to the requester.
  • On receiving REQUEST(j,n), site updates . An idle token holder sends the token to when .
  • On exit, the holder updates its LN entry, adds outstanding requesters not already in the token queue, and sends the token to the next queued site if there is one.
  • If the requester already holds an idle token, no message is needed. Otherwise the slide gives messages to obtain it and synchronization delay or .

PYQ — Semester 2025, CO3

Original question from the question paper

Give the correctness of Suzuki–Kasami’s broadcast algorithm.
Answer
  1. Safety: exactly one token exists and a site must hold it throughout its CS; therefore two sites cannot execute the CS simultaneously.
  2. Site records the greatest request number received from as ; the token records the latest completed request as .
  3. Under the one-outstanding-request-per-site model, identifies an outstanding request and prevents an old request from being treated as new.
  4. After its CS, the token holder records its completed request, adds outstanding requesters not already in the token queue and forwards the token to the queue head.
  5. Liveness: reliable eventual delivery makes a pending request known; finite CS executions and continued forwarding allow it to be queued and served.
  6. At most other sites have an outstanding request ahead under this model. With no failures and continued execution, the requester receives the token in finite time.

PYQ — Semester 2024, CO3

Original question from the question paper

Explain the different types of mutual exclusion algorithms.
Answer

8 marks

  1. Purpose: distributed mutual exclusion ensures that at most one site executes the critical section for a shared resource at a time.
  2. Token-based: a single unique token represents the right to enter; a site enters only while holding it.
  3. In Suzuki–Kasami, a site without the token broadcasts a request. The token contains a queue of waiting sites and is forwarded to a requester.
  4. Non-token-based / permission-based: a requester exchanges messages to obtain the permission required by the protocol; timestamps order competing requests.
  5. In Lamport’s algorithm, a site broadcasts a request, maintains a timestamp-ordered queue, waits for the required messages and broadcasts a release after its CS.
  6. In Ricart–Agrawala, the requester waits for a reply from every other site; a competing site may defer its reply until it finishes.
  7. Quorum-based: a requester obtains permission from a selected subset of sites rather than all sites. Every pair of quorums intersects.
  8. In Maekawa’s algorithm, a shared quorum member grants one vote at a time, ensuring safety. Basic Maekawa may deadlock, whereas modified Maekawa handles competing partial votes.

PYQ — Semester 2024, CO3: distributed setup

Original question from the question paper

How is mutual exclusion achieved in a distributed setup?
Answer

8 marks

  1. A distributed system has processes at different sites which cannot rely on a common local semaphore; they coordinate access to a shared resource by messages.
  2. A process requests entry, waits until its algorithm’s entry condition is satisfied, executes its CS and then releases its permission or token.
  3. Lamport: each site maintains a timestamp-ordered request queue. A requester broadcasts REQUEST and peers queue it and send timestamped replies.
  4. It enters when its request is first in its queue and it has a later timestamped message from every peer; after exiting it broadcasts RELEASE.
  5. Ricart–Agrawala: a requester broadcasts to all peers and enters only after all reply. A process defers a lower-priority competing request until it exits.
  6. Maekawa: a requester collects votes from an intersecting quorum; a common voter cannot vote for two conflicting requests simultaneously.
  7. Suzuki–Kasami: only the unique token holder may enter; the token is transferred to waiting requesters.
  8. These mechanisms ensure at most one site enters at a time. Progress additionally depends on reliable communication, continuing processes and finite CS executions; basic Maekawa may deadlock.

PYQ — Semester paper printed 2023 (file named 2022), CO3: progress

Original question from the question paper

How is progress assured in a mutual exclusion algorithm?
Answer

7 marks

  1. Progress / liveness: if processes request the CS, the protocol should continue to grant access; a pending request should not wait forever.
  2. Deadlock freedom: the system must not reach a state where requesters wait indefinitely in a cycle and none can proceed.
  3. Starvation freedom: each pending request must eventually be served, rather than being bypassed indefinitely.
  4. Ordering: Lamport and Ricart–Agrawala use timestamp priority and process IDs to order competing requests.
  5. Releasing permission: in Ricart–Agrawala, a process sends deferred replies when it exits, allowing waiting requesters to proceed.
  6. Token forwarding: Suzuki–Kasami records outstanding requests, queues them and transfers the unique token after the holder finishes.
  7. Progress assumes eventual message delivery, participating processes that continue to execute, and finite CS durations. Basic Maekawa can deadlock; its modified version uses FAILED, INQUIRE and YIELD to resolve competing votes.

6. Comparison for revision

AlgorithmPermission or tokenMessages per CS in the slide modelSynchronization delayMain limitation
LamportAll peers, timestamp-ordered queues; optimized to All peers participate; FIFO model
Ricart–AgrawalaAll peers, deferred repliesA missing reply can block progress
Basic MaekawaAll members of an intersecting quorumAbout Can deadlock; self-votes affect exact network counts
Modified MaekawaQuorum plus deadlock-handling messagesSlides give up to Depends on contentionExtra messages and coordination
Suzuki–KasamiUnique token and broadcast requests0 with idle token; otherwise slide gives 0 or Token must remain unique and available

Here is one message transmission delay in the slides’ performance model. The costs assume no failures and should not be treated as universal bounds under retransmissions, arbitrary delays or changed counting conventions.

PYQ — CT2 2026, Q3: choosing an algorithm for 100 sites

Original CT2 2026 Q3 with all four parts

A 100-site cloud platform has frequent simultaneous critical-section requests, variable network delays and occasional communication failures. Compare Lamport, Ricart–Agrawala and Maekawa in message complexity, synchronization delay and coordination overhead. Choose an algorithm, describe its behavior under heavy load, and give a limitation and an improvement. (10 marks)

Solution — For the standard comparison, take as one message delay and count one critical-section execution with 100 sites. Actual delays can grow with contention or disrupted delivery.

AlgorithmMessages per execution in the slide modelSynchronization delayCoordination
Lamport in the basic versionAll 99 peers participate. Each maintains an ordered queue and processes a separate release.
Ricart–AgrawalaAll 99 peers must reply. Deferred replies replace the release broadcast.
MaekawaAbout in the basic version, roughly at the upper end of the slide model with deadlock handling in the basic modelContact a quorum of roughly 10 voters. Intersecting quorums require vote tracking, with extra messages to resolve conflicts.

Choice and heavy load: Modified Maekawa is a reasonable choice if communication failures are transient and the required voters eventually respond. Small quorums reduce per-request traffic compared with contacting all 99 peers. Under heavy contention, overlapping quorums still queue requests at shared voters, and vote yielding and reassignment add communication and wait time. Throughput can be limited by busy voters and by the single shared critical section.

Limitation and improvement: A missing grant or release can stall sites that need that voter. For transient message loss, use acknowledged retries with unique request IDs and duplicate suppression to preserve the one-vote rule. A permanently unavailable voter needs safe quorum reconfiguration that preserves intersection and accounts for outstanding grants. A timeout alone cannot safely grant permission.

Result: Modified Maekawa reduces message traffic for this workload, with a longer basic handoff and additional work to manage contention and recover communication.

7. Additional concepts and past-paper questions

The following background extends the slides and precedes the related questions.

  • Centralized mutual exclusion: a coordinator keeps track of the resource and queues requests. A requester sends REQUEST; the coordinator sends GRANT when free; the requester sends RELEASE after its CS. A fair queue and eventual service prevent starvation. The coordinator can become a bottleneck and its failure can halt the basic protocol.
  • Applications: mutual exclusion protects concurrent updates or exclusive use of shared records, files, devices, reservations and scheduler state.
  • Asynchronous shared memory: processes communicate through registers with no fixed bound on relative process speeds. Registers can be categorized by who may read/write them and by safe, regular or atomic consistency semantics; the question below defines both classifications.
  • Bounded-delay optimization: if message delivery has a known upper bound, a process can interpret silence after a sufficient timeout as permission, provided the protocol explicitly reports withheld permissions and the timing and reliability assumptions hold.
  • Token response time: low load has little contention; high load adds waiting for other token holders. The precise time depends on the token protocol and its queue.

PYQ — Semester paper printed 2023 (file named 2022), MCQ

Original question from the question paper

Which characteristics apply to centralized mutual exclusion: a coordinator handles requests; request, reply and release messages are used; and the method is starvation-free?
Answer
  • Correct option: (d) All of the mentioned.
  • A coordinator handles requests, sends a grant/reply, and receives a release after the CS.
  • Starvation freedom holds if the coordinator uses a fair queue, messages are delivered and each CS finishes.

PYQ — CT2 re-test 2022, Q2 and Semester paper printed 2023, CO3

Original CT2 re-test 2022 Q2

Original Semester 2023 CO3, including the applications question

Write the applications of mutual exclusion methods.
Answer

7 marks

  1. Database updates: prevent concurrent transactions from interfering while updating the same record, such as an account balance.
  2. Distributed file access: serialize conflicting modifications to a shared file to prevent lost or inconsistent writes.
  3. Banking and payments: allow one operation at a time to update a protected account or transaction record.
  4. Inventory and reservations: protect stock counts or seat allocations so two users do not reserve the same last item.
  5. Shared peripheral devices: coordinate exclusive use of a printer, robot or other device that cannot safely handle conflicting commands.
  6. Distributed job scheduling: protect shared scheduler state so the same exclusive job or resource is not assigned twice.
  7. Shared counters and configuration: serialize read-modify-write operations on counters or protected configuration to avoid lost updates.
  • The critical section must cover the whole operation that requires exclusivity; the coordination mechanism must be reliable under the assumed failures.

PYQ — Semester 2024, CO3: centralized versus distributed

Original question from the question paper

What are the differences between centralized and distributed mutual exclusion?
Answer

7 marks

  1. Control: centralized uses one coordinator to grant access; distributed algorithms coordinate among multiple sites without a single permanent coordinator.
  2. Permission: a centralized requester asks the coordinator; distributed algorithms obtain all-peer permissions, quorum votes, or a unique token.
  3. Messages: centralized access normally uses REQUEST, GRANT and RELEASE—3 network messages when requester and coordinator differ. Lamport uses and Ricart–Agrawala per CS.
  4. Decision: the coordinator tracks whether the resource is free and queues requests; distributed decisions use timestamps, intersecting votes or token possession.
  5. Bottleneck: the coordinator handles all requests and may become a bottleneck; distributed designs spread coordination, though individual voters or token holders can still be bottlenecks.
  6. Failure: coordinator failure blocks the basic centralized scheme until recovery or replacement. Distributed algorithms also have failure weaknesses: a missing reply, failed voter or lost token can block progress.
  7. Complexity: centralized management is simpler; distributed approaches need more coordination and failure handling. Both can ensure safety and fairness when their respective assumptions hold.

PYQ — Class Test 1, Q3 and Semester 2021, Q3(a)

Original Class Test 1 Q3

Original Semester 2021 Q3(a)

Can Ricart–Agrawala’s message complexity be improved by modifying it for a synchronous system with bounded delay and unsynchronized zero-drift clocks?
Answer

8 marks

  1. Yes. Let be the known maximum one-way message delay. Zero-drift clocks need not agree on their displayed times: each site can measure elapsed intervals of .
  2. Replace an immediate positive reply by silence. On receiving a request, a site immediately sends a DENY only if Ricart–Agrawala would defer permission; it records the deferred request.
  3. A requester broadcasts its timestamped request and waits after sending. If no DENY arrives from a particular site by the deadline, it treats that site’s silence as permission.
  4. A site that has denied permission sends an explicit GRANT to that requester when it can release the deferred permission, normally on leaving its CS. A requester receiving DENY waits for that grant before entering.
  5. Why the timeout works: the request reaches a peer within and its immediate DENY, if needed, returns within another . Thus a missing denial after means that peer did not withhold permission, assuming reliable delivery and negligible processing time.
  6. For competing requests, the Ricart–Agrawala timestamp/ID rule still determines which permission is deferred. A process in the CS denies a conflicting request, preserving safety. Requests, denials and grants must identify the relevant request; handle a denial and grant received out of order correctly.
  7. With no contention, only request messages are sent instead of , so the message count improves. With contention, DENY and later GRANT messages add overhead; this is not a universal worst-case improvement.
  8. The method requires the stated strict delay bound, no message loss or crashes during the protocol, reliable elapsed-time measurement and a deadline rule that includes messages arriving exactly at . A timeout alone is unsafe if those assumptions fail.
  • Source: Ricart and Agrawala discuss changing the sense of replies under bounded message transmission time: original paper.

PYQ — CT2 2022 and semester paper printed 2023: asynchronous shared memory

Original question from the question paper

Original question from the question paper

Explain the types of asynchronous shared memory, describe a mutual exclusion algorithm, and explain progress in an asynchronous distributed system.
Answer

15 marks in CT2: 5 + 5 + 5. The semester paper assigns 6 + 8 + 7 marks.

(a) Types of asynchronous shared memory

  1. In an asynchronous shared-memory model, processes communicate by reading and writing shared registers; their relative execution speeds are not bounded.
  2. Registers may be classified by access: SRSW has one reader and one writer; MRSW has multiple readers and one writer; MRMW has multiple readers and multiple writers. Access classification is distinct from consistency semantics.
  3. A safe register returns the last completed value when a read does not overlap a write; a read overlapping a write may return any value in the register’s domain.
  4. A regular register returns the last completed value when there is no concurrent write; an overlapping read returns the previous value or a concurrently written value.
  5. An atomic register behaves as if every read and write occurs instantaneously at a point between its invocation and completion, respecting real-time order.

(b) Mutual exclusion algorithm: Lamport

  1. Each site keeps a queue ordered by logical timestamp and process ID; the slide model assumes FIFO channels.
  2. A requester inserts its request locally and broadcasts REQUEST to every other site. Receivers insert it in their queues and send timestamped REPLY messages.
  3. The requester enters when its request is at the head of its queue and it has received a later timestamped message from every peer.
  4. On exit it removes its request and broadcasts RELEASE; recipients remove that request. Each execution uses messages in the basic version.
  5. If two sites entered concurrently, the later request could not be at the head while the earlier pending request was present. Hence mutual exclusion holds.

(c) Progress in an asynchronous distributed system

  1. Asynchrony means there is no known fixed bound on process or message delays; it does not mean a correct message must be lost.
  2. Progress is established under assumptions of eventual message delivery, processes continuing to execute, and finite CS executions.
  3. Lamport’s timestamp order gives pending requests a consistent priority. Each peer eventually sends the required later message, and earlier requests eventually complete and release.
  4. The earliest pending request eventually reaches the head of its queue and enters; repeated releases allow subsequent requests to proceed. Thus there is no starvation under these assumptions.
  5. Failure or a permanently lost message can block an all-peer algorithm. Basic Maekawa can deadlock even without failures; additional deadlock handling is necessary.

PYQ — CT1 2024, Q2(c)

Original question from the question paper

What is the response time of a token-based mutual exclusion algorithm under low and high load?
Answer

2 marks

  1. Low load: there is little contention. In Suzuki–Kasami, response time is approximately if the requester already holds the idle token, or if it sends a request to an idle holder and receives the token. Here is one message delay and is CS duration.
  2. High load: the requester may wait for other CS executions and token transfers, so response time increases with queue position. As an illustrative model, if complete executions are ahead and each handoff takes , ; actual time depends on the token location and remaining execution time.
  • The bounded-delay Ricart–Agrawala question also appears in the 2021 semester paper; the 2022 and 2023 shared-memory questions have different mark allocations as noted above.