MIT‑Level Study Notes
Distributed Systems (BCA – Generic Elective)
Audience: Students who have already completed fundamentals of data structures, algorithms, and operating systems.
Goal: Gain a firm grasp of the theoretical foundations, formal models, and design principles that underpin modern distributed systems.
1. Introduction & Motivation
| Question | Why It Matters |
|---|---|
| What is a distributed system? | A collection of independent computers that appear to the user as a single coherent system. |
| Why study it? | Contemporary services (cloud, social media, finance, IoT) rely on scalability, fault tolerance, and global consistency. |
| Key challenges | Latency, partial failures, concurrency, distributed coordination, data consistency. |
First‑principle perspective:
Start from the you (user) and the system (hardware + software). The system must guarantee that operations performed by users are correct, confident, and timely, even when components fail or messages are delayed.
2. Formal Models
2.1 Process & Communication Model
| Element | Definition | Example |
|---|---|---|
| Process | A thread of execution that may run on a single processor or across many machines. | P1, P2, … |
| Message | A directed edge in a graph; contains data and metadata (timestamp, source). | msg(u→v) = (payload, timestamp) |
| Network | A directed graph G = (V, E) where V are processes and E are communication links. |
E = {(P1,P2), (P2,P3)} |
| Message‑passing semantics | FIFO, Causal, Unordered. | FIFO ensures order on a link. |
2.2 Fault Models
| Fault Type | Definition | Typical Problems |
|---|---|---|
| Crash fault | A process stops responding but does not send incorrect data. | Classic crash‑tolerant protocols (e.g., Paxos). |
| Byzantine fault | Process may send arbitrary, possibly conflicting messages. | Byzantine Generals, BFT consensus. |
| Network partition | Links fail, splitting network into sub‑graphs. | CAP theorem implications. |
Assumption: We usually assume partial synchrony – eventually messages are delivered within a bounded time (
Δ) and clocks drift is bounded (ϵ).
This is the Chandra–Toueg model used to prove impossibility results (e.g., FLP).
3. Time & Causality
3.1 Logical Clocks
3.1.1 Lamport Clocks
- Rule
- Every process
pmaintains a scalarC[p]. - Internal event:
C[p] ← C[p] + 1. - Send event:
C[p] ← C[p] + 1; attachC[p]to message. - Receive event: `C
- Every process