Distributed Computing Senior

1 / 36

Compare Strong Consistency vs. Causal Consistency. When would you prefer the latter?

Select the correct answer

1

Strong consistency lets replicas diverge and reconcile later automatically; prefer it when clients can tolerate reading somewhat stale values for a while.

2

Strong consistency orders only causally related operations locally per node; prefer it when concurrent writes never touch the same overlapping keys at all.

3

Causal consistency orders only causally related operations without global coordination; prefer it when you want ordering yet high availability and low latency.

4

Causal consistency requires every replica to agree synchronously on a total order; prefer it when correctness matters far more than availability or latency.

What is the difference between Linearizability and Serializability, and can a system be both?

Select the correct answer

1

Linearizability and serializability are the very same guarantee under different names, so asking whether a system can be both is essentially meaningless.

2

Linearizability concerns multi-object transaction ordering; serializability is a recency guarantee on single objects; no system can provide both together.

3

Linearizability is a real-time recency guarantee on single objects; serializability concerns transactions over many objects; a system can be both.

4

Linearizability guarantees eventual convergence of replicas; serializability guarantees isolation of transactions; combining both is possible but never useful.

What is the difference between Linearizability and Sequential Consistency? Which one is harder to achieve and why?

Select the correct answer

1

Both need one total order, but sequential consistency also respects real-time order; it is harder because clocks must be perfectly synchronized across nodes.

2

Both need one total order, but linearizability also respects real-time order; it is harder because it constrains even non-overlapping operations globally.

3

Linearizability allows reordering per process while sequential does not; sequential is harder because it demands a single global wall-clock timestamp source.

4

Neither requires a total order of operations at all; linearizability is harder only because it additionally requires transactions to be fully serializable.

Explain the PACELC theorem. How does it extend the CAP theorem, and what does it tell us about a system when there is no network partition?

Select the correct answer

1

It replaces CAP entirely by proving that consistency and availability can always coexist whenever the network is fully connected.

2

It states partitions never occur in practice, so systems only ever balance raw performance against the durability of stored data.

3

It extends CAP: if Partitioned choose A or C, Else choose Latency or Consistency; normally it is a latency-consistency tradeoff.

4

It extends CAP: during partitions choose A or C, Else choose Latency or Availability; normally it is a latency-availability tradeoff.

What is a Phi-Accrual Failure Detector, and how does it differ from a simple heartbeat timeout?

Select the correct answer

1

It outputs a continuous suspicion value from heartbeat-arrival statistics, instead of a fixed binary alive-or-dead timeout.

2

It replaces heartbeats with acknowledgements from every peer, producing a continuous value only once the whole cluster fully agrees.

3

It sends heartbeats more frequently than usual to detect failures faster, but still returns a simple alive-or-dead binary result.

4

It waits for a fixed timeout like a heartbeat but averages several rounds, giving the same binary output after multiple missed beats.

What is a 'Lease' in distributed systems, and how does it improve upon a standard heartbeat for failure detection?

Select the correct answer

1

A periodic signal that nodes send to peers to confirm that they are still alive and reachable

2

A lock held indefinitely by one node until it voluntarily chooses to release the shared resource

3

A time-bound grant of a right that expires unless renewed, so failure needs no consensus

4

A quorum vote that elects a fresh leader whenever the current leader stops answering requests

What is a cascading failure in a distributed system, and what techniques like load shedding help contain it?

Select the correct answer

1

A failure that overloads surviving nodes and spreads; load shedding drops excess requests to protect them

2

A failure where one node simply crashes; automatic failover reroutes its traffic to healthy replicas

3

A failure caused by a network partition; quorum reads are used to keep the whole system consistent

4

A failure that propagates via corrupted replication; checksums are used to detect and halt its spread

What are the omission and timing failure models, and how do they sit between crash and Byzantine failures?

Select the correct answer

1

Omission and timing both mean a node sends arbitrary malicious messages, making them worse than Byzantine

2

Omission and timing describe clean halting failures that are strictly simpler to handle than crash faults

3

Omission drops messages and timing responds outside bounds; both are worse than crash, milder than Byzantine

4

Omission means a node halts silently and timing means it sends corrupted values; both equal Byzantine faults

What is a Hotspot or Hot Key in a sharded system, and how can you detect and mitigate it at the architectural level?

Select the correct answer

1

A hot key is a shard that has crashed under load; detect via heartbeat timeouts and mitigate by promoting a follower replica to take over writes.

2

A hot key is one key or narrow range getting outsized traffic; detect with per-key metrics and mitigate by splitting, salting, or caching it.

3

A hot key is a key with an expired lease; detect through version vectors and mitigate by rerouting all traffic to a dedicated strongly consistent leader.

4

A hot key is a key that is never accessed; detect with per-key metrics and mitigate by merging cold shards together and disabling replication for it.

What is chain replication, and what are its trade-offs compared to leader-based replication?

Select the correct answer

1

Writes pass head to tail along a chain and reads come from the tail, giving strong consistency but adding latency and slower recovery on failures.

2

Writes and reads both hit the middle node of the chain, balancing load evenly but sacrificing durability whenever any single node in the chain fails.

3

Writes go to any node and propagate backward to the head, giving eventual consistency with very low latency but frequent conflicts needing reconciliation.

4

Writes are broadcast to all nodes at once and reads use quorum voting, maximizing availability but reducing overall write throughput under heavy load.

What is anti-entropy, and how do read-repair and Merkle trees help replicas converge in a leaderless system?

Select the correct answer

1

Anti-entropy is a compression scheme for logs; read-repair discards old versions during reads and Merkle trees compact the write-ahead log into snapshots.

2

Anti-entropy is a locking protocol between replicas; read-repair blocks writes during reads and Merkle trees enforce a total ordering of all updates.

3

Anti-entropy is a background sync of replicas; read-repair updates stale copies during reads and Merkle trees pinpoint diverging ranges cheaply.

4

Anti-entropy is a leader election method; read-repair chooses a new coordinator on reads and Merkle trees track which node holds the write lease now.

What are sloppy quorums and hinted handoff, and how do they improve availability in Dynamo-style systems?

Select the correct answer

1

Sloppy quorum requires a strict majority of home nodes for writes and hinted handoff replays a full log to rebuild any node that fell permanently behind.

2

Sloppy quorum accepts writes on any reachable nodes during failures and hinted handoff holds them temporarily to deliver back to the home node later.

3

Sloppy quorum elects a temporary leader to serialize writes and hinted handoff caches responses at the coordinator to speed up repeated key lookups.

4

Sloppy quorum blocks all writes until every home replica responds and hinted handoff queues reads so clients always see the most recently committed value.

What are Hybrid Logical Clocks (HLC), and why are they used in modern databases like CockroachDB or Spanner?

Select the correct answer

1

They synchronize every node's clock via NTP so that logical counters are no longer needed.

2

They replace physical clocks entirely with vector clocks to guarantee a total global ordering.

3

They use GPS and atomic clocks to remove all uncertainty from the timestamps across nodes.

4

They combine physical time with a logical counter to preserve causality with near-real-time values.

What is Clock Skew and Clock Drift, and how do these physical realities impact distributed algorithms like Spanner's TrueTime?

Select the correct answer

1

Skew is the rate of divergence, drift is the difference; TrueTime avoids both by using plain vector clocks.

2

Skew is the difference between clocks, drift is how fast they diverge; TrueTime bounds and waits out this uncertainty.

3

Skew and drift are the very same measure; TrueTime eliminates them completely using only atomic clocks.

4

Skew is network latency, drift is packet loss; TrueTime corrects them by retrying commits until synced.

What is TrueTime in Google Spanner, and how does bounding clock uncertainty enable externally consistent transactions?

Select the correct answer

1

An API returning a logical Lamport counter; Spanner increments it per transaction to totally order commits without physical clocks.

2

An API returning a time interval with bounded error; Spanner waits out that uncertainty before committing to guarantee correct ordering.

3

An API returning a single exact timestamp from atomic clocks; Spanner uses it to skip locking and commit transactions instantly.

4

An API returning a time interval with bounded error; Spanner picks the earliest bound and commits immediately without any waiting.

What are CRDTs (Conflict-free Replicated Data Types), and how do they allow for concurrent updates without a central coordinator?

Select the correct answer

1

Data types whose merge relies on last-writer-wins timestamps only, so replicas discard all but the newest concurrent update always.

2

Data types that use a central lock manager to serialize merges, so replicas converge to the same state regardless of update order.

3

Data types that broadcast every operation through a leader node, so replicas apply updates in a single globally agreed order.

4

Data types whose merge is commutative, associative and idempotent, so replicas converge to the same state regardless of update order.

What is the FLP Impossibility Result, and why is it impossible to guarantee consensus in a purely asynchronous system if even one node can fail?

Select the correct answer

1

Consensus fails because network partitions permanently split nodes into groups that can never reconcile their divergent states.

2

No protocol reaches consensus because Byzantine nodes send conflicting messages that end up corrupting every honest node's decision.

3

Consensus is impossible because asynchronous clocks drift apart and nodes can never agree on a shared global ordering of events.

4

No deterministic protocol can guarantee consensus when a node may crash, since a slow node is indistinguishable from a failed one.

What is the difference between Paxos and Raft, and why is Raft often preferred for practical implementations despite Paxos being the theoretical gold standard?

Select the correct answer

1

Raft avoids the need for a leader entirely, letting all nodes propose values symmetrically, which removes the single point of failure.

2

Raft requires fewer nodes to reach a quorum than Paxos does, so Raft achieves consensus faster under the same failure conditions.

3

Raft tolerates Byzantine failures while Paxos only handles crash faults, so Raft is safer for adversarial production environments.

4

Raft decomposes consensus into clear subproblems like leader election and log replication, making it easier to implement correctly.

What is the role of a 'Term' or 'Epoch' in consensus protocols like Raft or Paxos?

Select the correct answer

1

A unique identifier assigned to each client request so that duplicate commands are never applied more than once.

2

A counter of committed log entries that is used to detect when a follower has fallen behind the current leader's state.

3

A fixed time interval after which every node must restart and re-synchronize its entire log with the rest of the cluster.

4

A monotonically increasing number that orders leadership periods and lets nodes reject stale messages from older leaders.

In the context of distributed algorithms, what is the difference between a 'safety' property and a 'liveness' property? Why is it often impossible to guarantee both in an asynchronous system (FLP impossibility)?

Select the correct answer

1

Safety means nothing bad happens; liveness means something good eventually happens; FLP shows you can't guarantee both asynchronously.

2

Safety means messages arrive in order; liveness means they arrive quickly; FLP shows ordering and speed conflict once nodes fail.

3

Safety means data gets replicated; liveness means data is durable; FLP shows replication and durability trade off in async systems.

4

Safety means the system stays available; liveness means it stays consistent; FLP shows these two cannot coexist during a partition.

What is the difference between basic Paxos and Multi-Paxos, and why is Multi-Paxos more practical for replicated state machines?

Select the correct answer

1

Basic Paxos tolerates Byzantine faults per instance; Multi-Paxos drops that guarantee to gain speed on trusted replicas.

2

Basic Paxos agrees on many values at once; Multi-Paxos restricts each round to a single value to strengthen safety guarantees.

3

Basic Paxos needs a leader for every round; Multi-Paxos removes the leader so acceptors decide values independently in parallel.

4

Basic Paxos agrees on one value per instance; Multi-Paxos elects a stable leader to skip prepare phases across many entries.

What is the ZAB protocol used by ZooKeeper, and how does it differ from Paxos and Raft?

Select the correct answer

1

ZAB is a crash-recovery atomic broadcast protocol guaranteeing primary-order delivery, tailored for ZooKeeper's state updates.

2

ZAB is a leaderless voting protocol where clients directly commit, unlike Paxos and Raft which centralize all writes on a leader.

3

ZAB is a Byzantine-tolerant protocol that signs every message, unlike Paxos and Raft which assume only simple crash failures.

4

ZAB is a gossip-based protocol that spreads updates eventually, unlike Paxos and Raft which require strict synchronous quorums.

What is state machine replication, and why is a replicated log central to building consistent distributed systems?

Select the correct answer

1

A leader computes results and pushes final state snapshots down to all of its follower replicas.

2

Replicas execute the same deterministic commands in the same log order, reaching identical states.

3

Each replica logs commands locally and resolves any ordering conflicts using vector clock values.

4

Replicas run independent commands and periodically merge their divergent states into a single one.

What is total order broadcast (atomic broadcast), and why is it considered equivalent to consensus?

Select the correct answer

1

It only guarantees delivery, so it stays strictly weaker than actually solving consensus.

2

It orders messages by timestamps, which fully sidesteps the need for any agreement step.

3

Delivering messages in one agreed identical order requires nodes to agree on that order.

4

It broadcasts messages faster than consensus by avoiding any form of leader coordination.

What is the Chandy-Lamport algorithm for capturing a consistent global snapshot of a distributed system?

Select the correct answer

1

Processes broadcast their states, and the initiator selects the most recent consistent combination.

2

Each process periodically saves its state and messages, then merges them by vector clock timestamps.

3

A process records its state on a marker, then records incoming channel messages until markers arrive.

4

A coordinator freezes all processes simultaneously and copies their states using one global clock.

How does PBFT achieve consensus in the presence of Byzantine nodes, and how many faulty nodes can it tolerate?

Select the correct answer

1

Three-phase pre-prepare/prepare/commit voting tolerates f faulty of 3f+1 nodes.

2

Leader-based log replication tolerates f crashed nodes out of 2f+1 total nodes.

3

Two-phase coordinator voting tolerates f faulty nodes out of 2f+1 total nodes.

4

Proof-of-work mining rounds tolerate any minority fraction of the nodes acting maliciously here.

Compare 2PC vs. Sagas. When would you choose one over the other in terms of atomicity vs. availability?

Select the correct answer

1

Both provide identical atomicity, but Sagas need a central coordinator while 2PC does not.

2

Sagas give strong atomicity via locking; 2PC favors availability using compensating actions.

3

2PC gives strong atomicity via locking; Sagas favor availability using compensating actions.

4

2PC avoids locking for higher availability; Sagas block resources to ensure strict atomicity.

What is the difference between 'At-least-once' and 'Exactly-once' delivery? Why is 'Exactly-once' often described as an abstraction rather than a literal network guarantee?

Select the correct answer

1

At-least-once may deliver duplicates; exactly-once layers deduplication and idempotency on top of retries.

2

At-least-once needs no acknowledgements; exactly-once is guaranteed natively by most network transport layers.

3

At-least-once sends once without retries; exactly-once retransmits packets until the receiver finally confirms.

4

At-least-once drops messages on failure; exactly-once uses TCP acknowledgements to guarantee single delivery.

What is the Saga pattern, and how do 'Choreography' and 'Orchestration' compare in the context of long-running distributed transactions?

Select the correct answer

1

Choreography commits every step in one transaction; orchestration splits steps across several independent transactions.

2

Choreography uses a central coordinator issuing commands; orchestration lets services react to events fully independently.

3

Choreography coordinates via events with no central controller; orchestration uses a coordinator directing each step.

4

Choreography relies on a distributed lock per step; orchestration relies on compensating events broadcast to services.

What is the Three-Phase Commit (3PC) protocol, and how does it attempt to solve the blocking problem of 2PC?

Select the correct answer

1

It replaces the coordinator with a quorum vote so a majority of nodes can always commit without blocking.

2

It removes the prepare phase and lets each node commit locally, reconciling any conflicts asynchronously afterward.

3

It adds a pre-commit phase and timeouts so nodes can proceed independently if the coordinator fails.

4

It adds a rollback phase so any node timing out can undo commits and restart the whole protocol.

What is the TCC (Try-Confirm-Cancel) pattern, and how does it differ from a Saga?

Select the correct answer

1

TCC commits every step atomically together; Saga splits steps but keeps a distributed lock held throughout flow.

2

TCC compensates with reversing transactions after commit; Saga reserves resources first and confirms or cancels them.

3

TCC reserves resources in a Try step, then Confirm or Cancel; Saga compensates only after committing.

4

TCC uses a central coordinator with locks; Saga uses events among services with no reservation phase at all.

What is distributed deadlock, and how can it be detected or prevented across multiple nodes?

Select the correct answer

1

Deadlock is detected by counting retries per node; increasing the retry limit eventually resolves any blocked cycle.

2

Cycles in a local commit log indicate deadlock; a central coordinator must restart every blocked node together.

3

Cycles in a global wait-for graph indicate deadlock; timeouts or resource ordering can prevent it.

4

Deadlock occurs only when clocks drift; synchronizing timestamps across all nodes fully prevents it from happening.

Why is a simple 'distributed lock' often dangerous? Explain how 'Leases' and 'Fencing Tokens' solve the problem of a process holding a lock but being paused.

Select the correct answer

1

A lock can be acquired twice by one thread by mistake; leases add reentrancy counting and fencing tokens track the recursion depth safely.

2

A lock server becomes a throughput bottleneck under heavy load; leases batch the requests and fencing tokens shard the lock across partitions.

3

A lock without a timeout blocks forever if the client crashes; leases add retry logic and fencing tokens replay the queued operations later.

4

A paused process may resume after its lease expired and another holds the lock; monotonic fencing tokens let storage reject its stale write.

How do coordination services like ZooKeeper, etcd, and Chubby provide primitives such as locks and configuration, and why not build these yourself?

Select the correct answer

1

They use a single master database with row locking so clients see one truth; building your own just needs one shared SQL table.

2

They rely on client-side timeouts and retries to reach agreement; you avoid them because they add unnecessary network latency.

3

They broadcast state via gossip for eventual convergence; you skip them since any key-value cache gives you the same guarantees.

4

They run a consensus algorithm over a replicated log to offer consistent primitives; rolling your own correctly is extremely hard.

What is the SWIM protocol for membership and failure detection, and how does it improve on naive gossip?

Select the correct answer

1

It replaces gossip with a consensus round so all nodes agree on membership, trading extra latency for much stronger consistency.

2

It uses TCP keepalives between every pair of nodes to detect failures instantly, avoiding the false positives of random probing.

3

It centralizes failure detection in one monitor that heartbeats every node, reducing the message overhead of full gossip broadcasts.

4

It separates failure detection from dissemination, using randomized ping and ping-req probes plus piggybacked membership updates.

What are 'Hedged Requests' and how do they help reduce tail latency in a distributed environment?

Select the correct answer

1

Split each request across several replicas and combine their partial responses, reducing the amount of work any single node must do alone.

2

Send the same request to a second replica after a short delay and take whichever response returns first, cutting slow tail latencies.

3

Queue requests locally and send them only when a replica reports idle capacity, avoiding overload so no request ever hits a busy node.

4

Retry a failed request repeatedly on the same replica with growing delays until it succeeds, ensuring transient slowdowns never surface.