Sources grouped here: Introduction-DC.pdf, Logical-Clocks-and Event Ordering.pdf, and Synchronization-of-Clocks.pdf.

How to use this note

Definitions and rules use exam language. Plain meaning callouts translate difficult ideas into everyday language; Exam focus callouts flag high-yield facts and common traps.

1. Distributed computing: the foundation

  • A distributed system is a set of independent computers/processes on a network that communicate by passing messages and cooperate to achieve a common goal.
  • Processing and data storage are spread over several devices instead of one central device. Each device has its own processing capability and may manage its own data.
  • Ideally, the separate machines appear to the user as one coherent system.
Plain meaning

Google Drive may use many servers, but a user sees one drive. The machines must cooperate even though none of them is “the whole system.”

Distributed computing vs. distributed systems

AspectDistributed computingDistributed systems
Main concernSolving a computational problem by dividing it into tasksDesigning, implementing, and managing the networked system
FocusDistributed algorithms, programming models, concurrent executionInfrastructure, middleware, coordination, communication, failures, concurrency, no global clock
Typical applicationsParallel processing, grid computing, cloud computationClient-server systems, peer-to-peer systems, service-oriented systems

They overlap: distributed computing asks how many machines solve work together; distributed systems asks how to make that cooperation work reliably.

PYQ • CT1 2024, Q3(a)

In what respect is distributed computing better than a parallel-processing system?

Original CT1 2024 Q3(a)

Answer:

  1. Distributed computing shares resources: a machine can use remote storage, printers, databases, or idle CPU capacity.
  2. It improves throughput by splitting one problem into subproblems that execute concurrently on several processors.
  3. It is more fault tolerant: redundant components can continue service when one machine fails.
  4. It scales by adding processors, storage, or servers incrementally instead of replacing one central machine.
  5. It supports naturally geographically distributed work such as banking branches, ATMs, cloud services, and IoT systems.
  6. In contrast, a tightly coupled parallel-processing system usually shares one memory/address space; a distributed system is loosely coupled and communicates through a network.
  • Resource and information sharing: a user can use a printer, disk, database, or idle CPU attached to another machine.
  • Higher throughput: split a problem into subproblems and execute them concurrently. This can be cheaper than one extremely fast uniprocessor.
  • Fault tolerance: redundant components can keep service running after one component fails.
  • Scalability: improve capacity/performance by incrementally adding resources.
  • Inherently distributed applications: banking networks, geographically distributed ATMs, distributed process-control systems, edge/IoT smart cities, cloud platforms such as Google Cloud and AWS, and distributed ML/AI.

Desired characteristics

  • Fault tolerant: recovers from component failure without taking incorrect actions.
  • Highly available: restores operation and continues to provide service despite some failures.
  • Recoverable: a repaired failed component can restart and rejoin.
  • Consistent: concurrent actions and failures are coordinated so that the system behaves like one non-distributed system.
  • Scalable: growth in users, servers, or network size does not break correct operation or cause an unacceptable performance drop.
  • Predictable performance: provides required responsiveness in a timely way.
  • Secure: authenticates access to data and services.

2. Organization, operating systems, and middleware

Middleware

A distributed system often has a software layer between applications/users and each machine’s local operating system. This layer is middleware.

assets/slide-figures/distributed-system-organization.png

Slide visual - organization of a distributed system

Applications see the distributed layer and middleware; each machine keeps its own local OS underneath.

  • It supports heterogeneous machines and networks while presenting a single-system view.
  • It hides differences in hardware, OS, data format, and network communication.
  • It helps applications coordinate and communicate without each application implementing every network detail.
Plain meaning

Middleware is a translator and coordinator between an app and many unlike computers.

Tightly coupled and loosely coupled systems

  • Tightly Coupled System (TCS): multiple processors share one system-wide primary memory/address space. It is commonly called a parallel processing system.
  • A tightly coupled MIMD machine has separate processors executing different instructions on different data, connected to globally shared memory. Shared memory can simulate interprocess communication.
  • Loosely Coupled System (LCS): independent machines communicate across a network; this is the usual distributed-system model.
PYQ • Semester paper printed 2023, MCQ 8

What are the characteristics of a tightly coupled system? Choose among: same clock/shared memory, communication via shared memory, multiprocessors, and different clock.

Original Semester 2023 MCQ 8 and all answer options

Answer:

  1. A TCS has multiple processors sharing one system-wide primary memory/address space.
  2. Processes communicate through this shared memory.
  3. It is therefore a multiprocessor/parallel-processing system.
  4. “Different clock” is not the listed TCS property. The correct choice is same clock/shared memory, shared-memory communication, and multiprocessors. These are statements (i), (ii), and (iii). The printed option (b) repeats (ii).

Operating-system roles

An OS for distributed systems has two major goals:

  1. Act as a resource manager, allowing users/apps to share CPUs, memory, peripherals, network, and data.
  2. Hide heterogeneous hardware details by offering a convenient virtual machine for applications.
TypeKey points
Distributed Operating System (DOS)Tightly coupled; acts like a virtual uniprocessor; retains a global resource view; used for multiprocessors/homogeneous multicomputers; dynamically allocates jobs to machines.
Network Operating System (NOS)Loosely coupled; exposes local services to remote clients; used for heterogeneous multicomputers. Middleware enhances a NOS to provide better distribution transparency.

3. Goals and transparency

The goals are connecting users/resources, transparency, openness, and scalability. Transparency means making the multiplicity and physical distribution of computers invisible, giving the user a single-system image.

Eight forms of transparency

assets/slide-figures/access-transparency.png

Slide visual - access transparency

The client uses one interface even though the resource is remote and data representation may differ.

  1. Access transparency - access a remote resource like a local resource; hide data-representation and access-method differences.
  2. Location transparency - a resource name should not reveal its physical location. Names should be system-wide unique, so a resource may move without changing its name. A user can log into any machine and use the same resource name.
  3. Replication transparency - hide that several copies exist. Replicas raise availability and can improve performance when placed near users. Replication transparency generally implies location transparency.
  4. Failure transparency - hide partial failures such as link, machine, or storage crashes. It is hard because a slow resource can look identical to a dead one.
  5. Migration transparency - the system automatically decides migration; an object/process can move nodes without a name change. Messages sent during process migration must still arrive without forcing senders to resend.
  6. Concurrency transparency - users/processes can share resources safely. It requires event ordering, mutual exclusion, no starvation, and no deadlock.
  7. Performance transparency - automatically reconfigure to improve performance.
  8. Scaling transparency - expand without disrupting users; requires open architecture and scalable algorithms.
Plain meaning

Transparency means the system does not make users care where a file is, how many copies it has, whether it moved, or which server did the work.

PYQ • Semester 2025, CO1(a)

Mention the types of transparencies present in distributed systems.

Original Semester 2025 CO1(i)(a) on transparency

Answer:

  1. Access: remote resources are used like local ones; hides data-format/access differences.
  2. Location: a name does not reveal physical location; the resource can move without renaming.
  3. Replication: hides multiple copies used for availability or performance.
  4. Failure: hides partial link, machine, or storage failures where possible.
  5. Migration: moves an object/process automatically without changing its name or losing messages.
  6. Concurrency: enables safe sharing through ordering, mutual exclusion, no starvation, and no deadlock.
  7. Performance: reconfigures automatically to improve performance.
  8. Scaling: expands without disrupting users, using open architecture and scalable algorithms.

4. Scaling, design pitfalls, and models

Scaling problems

  • Size: a single server can overload. Sometimes it is unavoidable, for example when confidential information is centralized. Prefer decentralized algorithms where no machine knows the whole state, decisions use local information, one failure does not ruin the algorithm, and no global clock is assumed.
  • Geography: LAN-oriented synchronous assumptions cause unacceptable delay in WANs. LANs are generally reliable and support broadcast; WANs are often unreliable and point-to-point, so they need location services. Centralized country-wide services, such as one mail server, hinder geographical scalability.
  • Administrative domains: organizations can have conflicting policies for resource use/payment, management, and security.

Design guidance

  • Avoid centralized entities and centralized algorithms (for example, centralized scheduling).
  • Perform as much work as possible on client workstations.
  • Remember the fallacies of distributed computing: the network is reliable; latency is zero; bandwidth is infinite; the network is secure; topology never changes; transport is free; and the network is homogeneous. All are false in practice.

Core issues to handle

  • event ordering without a global clock;
  • leader election;
  • unreliable communication;
  • capturing global state without global knowledge;
  • mutual exclusion;
  • synchronization and causal ordering;
  • managing many distributed resources and replicas;
  • failure/recovery; and termination detection.

Distributed programs are hard to verify because actions can interleave arbitrarily, there is no shared global memory for collecting state, no global clock, and communication delays are unpredictable.

Distributed-algorithm model and complexity

An algorithm must state its assumptions:

  • Topology: complete graph, ring, tree, etc.
  • Communication: shared memory or message passing; reliability, delay, FIFO/causal delivery, broadcast/multicast.
  • Timing: synchronous or asynchronous.
  • Failure model: fail-stop, crash, omission, Byzantine, etc.

Measures:

  • Message complexity: number of messages.
  • Communication/bit complexity: number of bits sent.
  • Time complexity: rounds in a synchronous system; a model-specific definition in an asynchronous system.

Google File System (GFS) design lesson

GFS illustrates distributed design under real constraints:

  • Component failures are normal with thousands of inexpensive machines; bugs, people, disks, memory, connectors, networks, and power all fail. Monitoring, detection, fault tolerance, and automatic recovery are integral.
  • Files can be multi-GB and contain billions of application objects.
  • Most changes are appends; random writes are rare. Many files are written once and read sequentially.
  • Reads include large repository analysis, streaming reads, and small forward random reads.
  • Sustained bandwidth matters more than latency, and APIs may need redesign for this workload.

PYQ — Semester 2025, CO5(i)

Original Semester 2025 CO5, including part (i)

Question

What are GFS’s primary design principles, and how do they address large-scale Google data processing?

Answer
  1. GFS assumes component failure is normal because it contains thousands of inexpensive components.
  2. It is designed for multi-GB files and very large numbers of application objects.
  3. It is optimized for append-heavy workloads; random writes are rare and many files are read sequentially.
  4. It values sustained bandwidth more than individual-operation latency.
  5. These assumptions fit large repository analysis, streaming reads, and large-scale data processing.

PYQ — Semester 2025, CO5(ii)

Original Semester 2025 CO5, including part (ii)

Question

How does GFS balance scalability with fault tolerance, and what architectural decisions support it?

Answer
  1. Scalability comes from incrementally adding resources and supporting huge files/large object populations.
  2. Fault tolerance comes from treating failure as normal and making monitoring, error detection, automatic recovery, and fault tolerance integral to the system.
  3. Detailed GFS architectural decisions: Out of supplied material.

PYQ — Semester 2025, CO5(iii)

Original Semester 2025 CO5, including part (iii)

Question

Which mechanisms handle hardware failures and minimize downtime?

Answer
  1. The supplied material lists continuous monitoring and error detection.
  2. It also lists fault tolerance and automatic recovery as integral mechanisms.
  3. These address failures of memory, disks, connectors, networks, and power supplies.
  4. Specific GFS implementation mechanisms: Out of supplied material.

PYQ — Semester 2025, CO5(iv)

Original Semester 2025 CO5, including part (iv)

Question

Where and how does the GFS Master store metadata?

Answer

Out of supplied material.

PYQ — Semester 2025, CO5(v)

Original Semester 2025 CO5, including part (v)

Question

How does GFS implement replication and consistency, and what availability/durability trade-offs are made?

Answer

Out of supplied material.

PYQ — Semester 2025, CO5(vi)

Original Semester 2025 CO5, including part (vi)

Question

What is the role of chunk size and how does its configuration affect performance and resource utilization?

Answer

Out of supplied material. The lectures only state that large files require a reevaluation of I/O operations and block sizes.

PYQ — Semester 2025, CO5(vii)

Original Semester 2025 CO5, including part (vii)

Question

How is a write operation performed in GFS?

Answer

Out of supplied material. The notes only state that most modifications are appends and random writes are rare; they do not define the GFS write protocol.

5. Physical-clock synchronization (synchronous systems)

Physical clocks and their errors

assets/slide-figures/physical-clock-drift.png

Slide visual - physical clock drift

The lines diverge because clocks tick at slightly different rates; the increasing gap is clock skew.

  • A computer clock often uses a quartz oscillator. Quartz is piezoelectric: mechanical stress produces voltage. The oscillator is part of a self-feedback loop, often around 32 kHz; processors derive higher frequencies by division.
  • Typical quartz clocks drift roughly ±15 seconds/month (about 6 ppm), so ordinary quartz clocks are inadequate for large distributed systems.
  • Clock skew/offset: difference between the readings of two clocks.
  • Clock drift: clocks run at different rates, so their skew changes over time. Ordinary quartz clocks may drift about one second in 11-12 days. A maximum drift-rate bound helps decide how often to resynchronize.
  • Atomic clocks use Caesium-133 as an oscillator and are far more accurate (the slides state about ).

GPS and NTP

assets/slide-figures/gps-satellite-time.png

Slide visual - GPS as an external time source

A receiver combines satellite position and atomic-clock timestamps to estimate both its location and clock error.

  • GPS satellites broadcast position and atomic-clock time .

  • A receiver has unknown position and clock error . For a satellite, distance equals signal-travel time times the speed of light:

    Four unknowns require at least four satellite equations.

  • NTP (Network Time Protocol): clients contact network time servers. Stratum-1 servers have accurate clocks and may synchronize with still more accurate stratum-0 sources. A client estimates its drift relative to an NTP server.

Cristian’s algorithm and Berkeley algorithm

Cristian’s algorithm

assets/slide-figures/cristian-algorithm.png

Slide visual - Cristian’s algorithm

The client uses the request/reply exchange and an equal-delay assumption to estimate the correct time.

  1. Client sends request at local time .

  2. Server receives at , replies at .

  3. Client receives reply at .

  4. Assuming equal request/reply delay and negligible/known server processing, estimate clock offset from the server time at the round-trip midpoint:

The assumption is important: unpredictable asymmetric delay produces error.

Berkeley algorithm

assets/slide-figures/berkeley-algorithm.png

Slide visual - Berkeley algorithm

A master polls group members, estimates their drift, then sends each one an adjustment.

  1. Choose a master among nodes.
  2. Master uses Cristian-like exchanges to estimate drift with each slave.
  3. Master computes a mean drift and tells each slave how much to adjust.
  4. The aim is relative agreement among the group while minimizing the adjustment each slave makes.

PYQ — CT1 2026, Q1: Cristian and Berkeley

Original CT1 2026 Q1 with all four parts

A client sends a request at 10:15:20.200 and receives the reply at 10:15:20.500. The server returns 10:15:20.320. Find the round-trip time and Cristian estimate, explain its uncertainty, and choose an approach for hospital servers without a permanently reliable central time source.
Answer
  1. The round-trip time is ms. Assuming equal delays and negligible server processing, the return delay is ms, so set the client to 10:15:20.470 on receipt.
  2. This is an estimate: unequal outbound and return delays and server processing time change the actual return delay.
  3. Berkeley is a reasonable choice for internal agreement because the group can estimate and average member clocks without a permanent external time server. It still requires a master and a way to replace it if it fails; variable delays and outliers reduce accuracy. Clock synchronization alone does not establish causal event order.

External and internal synchronization

  • External synchronization: every group clock stays within bound of external standard clock : . Examples: Cristian’s algorithm and NTP, with UTC/atomic time.
  • Internal synchronization: every pair of group clocks remains within : for all . Examples: Berkeley and DTP.

Totally ordered multicast using synchronized clocks

Goal: all recipients deliver multicast messages in the same order when network delay is nondeterministic but bounded by .

  • Sender timestamps each message with local time.
  • For timestamp , receiver places it in a receive queue at time .
  • Receiver delivers queued messages in timestamp order.
  • Safe delivery requires knowing that all smaller-timestamp messages are already in the queue and that none can still arrive later.
Plain meaning

A timestamp alone is not enough; a receiver must wait long enough that a delayed older message cannot jump the queue.

PYQ — CT Re-test 2022, Class Test 1 Q2

Original 2022 CT1 re-test Q2

Question

What are global and local clocks? Illustrate for a graph.

Answer
  1. A local clock is the hardware/software clock maintained independently by one process or node.
  2. For example, quartz clocks can drift, so two nodes can show different times for the same physical instant.
  3. A true global clock would give one common system-wide time. In distributed systems it is not reliably available because message delays are unpredictable and local clocks run at different rates.
  4. In the graph below, and are local clocks. The message takes time to travel, so observing another node’s time does not create a perfectly shared global time.
flowchart LR P1["P1<br/>local clock C₁"] -->|"message m: delayed"| P2["P2<br/>local clock C₂"]

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

Original Semester 2023 CO2 on local and global clocks

Original Semester 2023 alternative CO2 on timing, asynchrony and snapshots

Question

What are global and local clocks? Explain them for a graph network. Also explain local/global timing and how asynchrony is handled.

Answer
  1. Each node in a graph network owns a local clock; nodes do not automatically share one time source.
  2. A global clock is an ideal common reference, but delay and drift prevent processes from observing it simultaneously.
  3. Local timing describes the progress of one process using its own clock. Global timing would describe a common order/time across all processes.
  4. Physical-clock synchronization can reduce clock differences using Cristian’s algorithm, Berkeley, GPS, or NTP.
  5. In an asynchronous model, there is no fixed upper bound on communication delay or interval between process steps; algorithms therefore cannot rely on a timeout as proof of failure.
  6. When physical time is unnecessary, logical clocks and vector clocks provide causal/event ordering without requiring synchronized physical clocks.

PYQ — Semester 2024, CO1(b)

Original Semester 2024 CO1(b)

Question

Explain local and global clock.

Answer
  1. A local clock belongs to one node and is advanced by that node’s hardware oscillator.
  2. Clock skew is the difference between two clock readings; drift means their rates differ, so skew changes over time.
  3. A global clock would be a system-wide common time. Distributed systems do not reliably have one because processes observe time after different communication delays.
  4. GPS/atomic clocks and NTP provide close external synchronization; Berkeley provides internal synchronization among group members.

PYQ — Semester 2025, CO1(ii)(b)

Original Semester 2025 CO1(ii)(b)

Question

Differentiate synchronous and asynchronous distributed systems. Give an application where unsynchronized physical clocks could cause a security breach.

Answer
  1. In a synchronous system, processing is divided into lockstep rounds: processes send messages, messages are delivered, then processes compute.
  2. In an asynchronous system, there is no fixed upper bound on message delay or on the time between process steps.
  3. A synchronous model can measure time by number of rounds; an asynchronous model cannot safely infer failure merely from delay.
  4. Unsynchronized clocks can make a time-limited authentication token, certificate, or expiry check appear valid at one node and expired at another.
  5. This can cause incorrect acceptance or rejection of an access request, so time-sensitive security systems need clock synchronization.

6. Why a global clock is absent

  • A system-wide common clock is not practically available. Message delays mean different processes can observe a “global” clock at different physical instants.
  • Each node’s local hardware clock has different rate/granularity and drifts from others.
  • “At the same time” is observer-dependent when information takes time to travel; different observers can disagree on the order of two distant events.

Impact:

  • OS scheduling depends on arrival order.
  • Designing/debugging is difficult because temporal order is unclear.
  • It is hard to obtain a current global state.
  • Replicated-database updates can become inconsistent when replicas apply updates in different orders.
  • File builds can be wrong if a compiler’s clock says a source file is older/newer than it really is.

Do not confuse physical clock synchronization with causal ordering. A receiver also needs to know how to interpret a sender’s clock/signal, not merely the bit pattern sent.

PYQ — CT1 re-test 2026, Q1(c): physical clocks

Original CT1 re-test 2026 Q1(c)

Why is it difficult to keep physical clocks synchronized in a distributed system? (4 marks)
Solution
  1. Independent oscillators run at slightly different rates, so their readings drift apart after each synchronization.
  2. A clock reading arrives through the network. Its one-way delay is generally unknown and can vary with routing, queueing and load.
  3. Even when we measure the round-trip time, unequal delays in the two directions can bias the estimated clock offset.
  4. Servers or links may become unavailable, so refreshing the estimate can also be delayed.

Result: A clock protocol can maintain an estimated error bound under suitable timing assumptions. It must resynchronize periodically to limit drift.

7. Happened-before relation and Lamport scalar clocks

Causality

assets/slide-figures/causal-vs-concurrent-events.png

Slide visual - causality versus concurrency

Message arrows create causal links; events with no causal path between them are concurrent.

Lamport’s happened-before relation is written and is a partial order:

  1. Same process: if event occurs before , then .
  2. Message: if sends message and receives that same message, then .
  3. Transitivity: and imply .

If neither nor , then : the events are concurrent (not causally related). Every event pair is either ordered one way or concurrent.

Plain meaning

Causality requires a chain by which information from the first event could reach the second. Different machines doing unrelated work are concurrent.

Lamport logical clocks

assets/slide-figures/lamport-clock-advance.png

Slide visual - Lamport clocks advancing

Receiving a message may force a process to jump its logical clock forward, preserving send-before-receive order.

  • Every process maintains scalar clock .
  • Event at has timestamp .
  • It is not physical time; it only increases monotonically to preserve causality.

Required clock condition: if , then .

Conditions:

  • C1: within one process, earlier event has lower timestamp.
  • C2: sending a message has lower timestamp than receiving it.

Implementation (d normally 1):

  1. IR1: before/between every local event, send, or receive, increment: .
  2. IR2: a sent message carries . On receipt at , after IR1, set .

PYQ — CT1 2026, Q2: Lamport clocks and concurrency

Original CT1 2026 Q2 with all four parts

Initially all clocks are zero. performs , sends to , then independently performs . receives , performs , and sends to . performs before receiving , then performs . Assign timestamps and identify causality and concurrency.
Answer
  1. Increment by one for each event and use on receipt. The timestamps are: , send , ; receive , , send ; , receive , .
  2. Among , the causal pairs are , , , , and . The other pairs are concurrent: , , , and .
  3. These follow from process order, the two send-to-receive links, and transitivity. For example, .
  4. Lamport timestamps preserve causality in one direction only. Distinct events with equal scalar timestamps are concurrent. Unequal timestamps leave both causality and concurrency possible.

Ordering properties and limitation

  • Scalar clocks are consistent: implies .
  • They can create a total order by breaking equal timestamps with a process ID. A total order compares every pair and yields one sequence.
  • Happened-before is only a partial order: concurrent events need not be comparable; several valid sequences can exist.
  • Scalar clocks are not strongly consistent: does not imply . The order can be artificial because scalar clocks compress causal knowledge into one number.
Exam trap: Lamport clocks

but

PYQ — CT1 re-test 2026, Q1(a–b): concurrency and scalar clocks

Original CT1 re-test 2026 Q1(a–b)

Using happened-before, define concurrent events. Explain the limits of Lamport scalar clocks for tracking causality when messages are delayed and events are concurrent. (4 + 4 marks)
Solution

(a) Distinct events and are concurrent, written , when neither nor . Check local event order, send-to-receive arrows and all paths implied by transitivity.

(b) A receive takes , so a delayed message still has a timestamp smaller than its receive. While it is in transit, the receiver can perform other events and advance its counter independently. Those events may have larger timestamps than the send even though they did not receive information from it. The difference between scalar timestamps also gives no elapsed time or network delay.

Result: implies . Equal timestamps prove concurrency for distinct events. Unequal timestamps alone cannot distinguish a causal pair from a concurrent pair.

PYQ • Semester 2025, CO1(i)(b)

Explain how logical clocks can be used to mark a unique timestamp for each event across different nodes.

Original Semester 2025 CO1(i)(b) on logical clocks

Answer:

  1. Each process keeps a monotonically increasing scalar clock ; it is logical time, not physical time.
  2. Before every local, send, or receive event, increment the clock: (normally ).
  3. On send, attach the current timestamp to the message.
  4. On receive at , first advance the local clock, then set .
  5. Thus if , then . Equal timestamps from different processes can be made unique by ordering pairs .
  6. The result gives a total order for protocols, but alone does not prove that caused .

8. Vector clocks and causal delivery

Vector clock idea

assets/slide-figures/vector-time-example.png

Slide visual - vector time

Each process stores one counter per process, so a timestamp records both its own events and what it knows about others.

For processes, each maintains vector .

  • : number of events so far at .
  • : knows that events have happened at .
  • The whole vector is ‘s current view of global logical time.

Rules:

  1. Before every local/send/receive event at , increment own component: .
  2. A message carries the sender’s vector timestamp.
  3. On receipt at , merge componentwise: for every (after the event increment).

Compare vector timestamps

For vectors and :

  • iff every component of is no larger than its corresponding component in .
  • iff and they are not equal.
  • They are concurrent iff neither nor .
  • Therefore iff ; otherwise the events are concurrent.

Vector clocks are strongly consistent, unlike scalar clocks: their timestamps are necessary and sufficient to identify causal order. Their dimension cannot generally be less than the number of processes n if this property must hold.

PYQ — CT1 re-test 2026, Q1(d): scalar and vector clock calculation

Calculate the Lamport scalar and vector timestamps of events through on processes and . The process orders are and , with message arrows , , , and . (8 marks)

Original CT1 re-test 2026 Q1(d) and its two-process event diagram

Solution — Start the scalar clocks at and the vectors at in component order . A send increments the local counter or component and carries the resulting timestamp. A scalar receive takes the maximum and adds one. A vector receive takes the componentwise maximum and then increments the receiver’s component.

For example, carries scalar and vector . At , has scalar and vector from . Therefore and . Applying the same rule at , the receive of gives and .

Result

ProcessEventActionLamport timestampVector timestamp
Send to 1
Send to 2
Send to 3
Receive from 4
Receive from 6
Receive from 2
Send to 3
Receive from 4
Send to 5
Receive from 6

Causal message delivery

assets/slide-figures/vector-clock-causal-delivery.png

Slide visual - using vector clocks for causal delivery

A receiver delays a message until its timestamp says all causal predecessors have already been delivered.

If , any process receiving both must deliver to its application before .

When receives message from , delay application delivery until:

  1. - it is the next message expected from sender .
  2. for every - receiver has already seen all causal predecessors known by the sender.
Causal-delivery memory aid

Next from sender + all dependencies already seen. The first test checks sequence from ; the second checks everything knew before sending.

PYQ — CT1 2024, Q1(a)

Original CT1 2024 Q1(a) and all vector-clock options

Question

For events at different processes, decide whether and are true. Identify concurrent vector timestamps from the supplied options.

Answer
  1. Both implications are false. Concurrency is not transitive, so relations involving do not determine the causal relation between and .
  2. To identify concurrent timestamps, compare every component of the two vectors.
  3. If componentwise and at least one component is strictly smaller, then .
  4. If neither nor , the timestamps are concurrent.
  5. Option B is the concurrent set. For example, and have opposite order in their second and fourth components. The third vector has a smaller third component but a larger first component than both.

PYQ — CT1 2024, Q1(b)

Original CT1 2024 Q1(b)

Question

Since vector-clock size grows linearly with , can causality/concurrency be detected using clocks smaller than ? Justify.

Answer
  1. In general, no: exact, strongly consistent causality detection requires at least vector components for processes.
  2. Each component records knowledge of one process’s local progress.
  3. Removing components loses causal-dependency information and can make concurrent events appear ordered.
  4. The supplied material cites Charron-Bost’s result that vector-clock dimension cannot generally be less than the number of processes when strong consistency is required.

PYQ — CT1 2024, Q1(c)

Original CT1 2024 Q1(c)

Question

What are version vectors, and how do they ensure eventual consistency?

Answer

Out of supplied material. The lecture PDFs cover vector clocks and causal delivery, but do not cover version vectors or eventual-consistency protocols.

PYQ — CT1 2024, Q1(d)

Original CT1 2024 Q1(d)

Question

How can vector clocks enforce causal communication?

Answer
  1. Every message carries the sender’s vector timestamp.
  2. When receives a message from , it delays application delivery until .
  3. This first condition means the message is the next one expected from sender .
  4. It also requires for every .
  5. This second condition means has already seen every causal predecessor known by when it sent the message.
  6. After delivery, the receiver merges timestamps componentwise using maximum values.

PYQ — Semester 2025, CO1(i)(d): causal-broadcast vector clocks

Original Semester 2025 CO1(i)(d) and its three-process vector-clock diagram

Question

Describe the events in the vector-clock diagram and explain what vectors reveal about causality that Lamport’s scalar clock cannot.

Answer
  1. The components are ordered . These vectors count broadcasts delivered from each process, so a delivery merges the message vector and a broadcast increments the sender’s component.
  2. makes the first broadcast with . Both and deliver it and reach .
  3. then broadcasts with . Its transmission to arrives before the first broadcast from , so buffers it. After delivering ‘s earlier broadcast, can deliver ‘s broadcast. also delivers ‘s broadcast and reaches .
  4. broadcasts again, this time with . Both and deliver it and reach .
  5. With full event vector clocks, componentwise comparison captures happened-before and incomparable vectors identify concurrency. Scalar Lamport clocks give , but unequal scalar timestamps alone do not establish causality.

PYQ — Semester 2025, CO1(ii)(a): concurrency in the space-time diagram

Original Semester 2025 CO1(ii)(a) with all nine events and message arrows

Question

List all concurrent pairs, add the two requested events, and explain how vector clocks enforce causal delivery.

Answer
  1. Read the time axis upward. The left process orders and the right orders . The message edges are , , and .
  2. The 11 concurrent pairs are , , , , , , , , , , and . Each has no path in either direction.
  3. Add a send on the left between and and its receive on the right after . This send is concurrent with .
  4. Add a local event on the right between and . It is concurrent with because the first message from the left reaches the right only at and this new event has no outgoing message.
  5. On receipt from , buffer the message until its sender component is exactly one greater than the receiver’s record of , and every other component is at most the receiver’s corresponding component. This enforces sender order and ensures the receiver has delivered all causal predecessors.

PYQ — Semester 2021, Q1

Original Semester 2021 Q1 with the three-process diagram and complete event table

Question

Update all vector clocks for the three sites using Birman–Schiper–Stephenson causal broadcast.

BSS counts broadcasts and deliveries in component order . A broadcast increments the sender’s own count. An arrival stays buffered when either causal-delivery test fails.

ProcessEventActionVector after the event
Deliver
Broadcast
Deliver
Broadcast
Broadcast
Deliver
Buffer while is missing
Buffer while its dependency is missing
Deliver , then drain both eligible messages after , then after both

Once delivers , the remaining messages are concurrent. Delivering first gives intermediate . Delivering first gives intermediate . Both orders end at .

PYQ — Class Test 1, Q1

Original Class Test 1 Q1 on the second BSS delivery condition

Question

Show, with an example, why Birman-Schiper-Stephenson fails if its second delivery condition is omitted.

Answer
  1. Consider a sender that has already received a message from another process and then sends message to .
  2. That earlier message is a causal predecessor of because information from it may influence .
  3. If checks only whether is next from , it may deliver before receiving the predecessor from .
  4. The omitted condition prevents this: it forces to wait until it has seen all causal predecessors known by the sender.
  5. Therefore omitting the second condition violates causal ordering at the application layer.

Costs and efficient differential timestamps

Vector timestamps increase message size linearly with the number of processes. The Singhal-Kshemkalyani differential technique sends only entries that changed since the last message to that receiver.

  • Instead of an entire vector, send tuples such as {(i1,v1), ..., (im,vm)}.
  • Receiver updates only those components using max.
  • Worst case still sends all n entries, but average size is often smaller.
  • Directly remembering a full last-sent vector per destination costs O(n^2) storage per process.
  • The optimization uses two O(n) vectors:
    • LS_i[j]: value of VT_i[i] when P_i last sent to P_j.
    • LU_i[j]: value of VT_i[i] when P_i last updated its entry for P_j.
  • Send component to only when . FIFO channel delivery is required.

9. Matrix clocks

Matrix clocks extend vector clocks to represent knowledge about knowledge.

  • Each P_i maintains MT_i[1..n,1..n].
  • MT_i[i,i]: P_i’s local logical time.
  • MT_i[i,j]: P_i’s latest knowledge of P_j’s local time.
  • MT_i[j,k]: what P_i knows that P_j knows about P_k’s time.

Rules:

  1. Before an event, increment MT_i[i,i].
  2. Piggyback the matrix on messages. On receipt from P_j, merge P_j’s row into P_i’s row and merge all matrix entries componentwise by max; then increment own clock and deliver.

The row has the vector-clock properties. In addition, if , knows every process knows that has advanced past ; obsolete information before can often be discarded safely.

10. Course context in the source material

The course syllabus groups the subject into: models/issues/complexity/correctness; clocks and causal ordering; global snapshots and termination detection; wave/traversal/leader-election algorithms; distributed mutual exclusion; deadlock detection; distributed file systems including NFS/GFS; and distributed transaction/concurrency control. Reference books listed are Singhal & Shivaratri, Gerard Tel, Nancy Lynch, and Coulouris/Dollimore/Kindberg.