Node A sends a message to Node B. A's HLC physical part is 500ms; B's current HLC physical part before receiving the message is 300ms; B's wall clock reads 450ms. After receiving the message, what is B's new HLC physical part?
A300ms — B keeps its own physical part to avoid jumping forward
B450ms — B always uses its local wall clock for the physical part
C500ms — B takes the maximum of its current physical part, A's physical part, and its wall clock
D400ms — B averages A's physical part and its own wall clock to prevent large jumps
The HLC 'max' rule sets the physical part to the maximum of: the receiver's current HLC physical part (300ms), the sender's HLC physical part (500ms), and the receiver's local wall clock (450ms). The maximum is 500ms. This ensures the physical part never goes backward along causal chains: any event causally following A inherits A's best-known physical time, keeping the timestamp close to real time while maintaining causal monotonicity.
Question 2 Multiple Choice
A distributed systems engineer needs to determine definitively whether two events A and B are concurrent (neither caused the other). Should they use HLC timestamps or vector clocks?
AHLC, because comparing the physical part first and the logical part second directly encodes concurrency information
BHLC, because its two-component structure is mathematically equivalent to a vector clock for detecting concurrency
CVector clocks, because HLC can only tell you that A happened before B or that the order is undetermined — it cannot confirm that two events are explicitly concurrent
DEither works identically; HLC is simply a more compact encoding of the same causal information as vector clocks
HLC preserves the Lamport clock property: if A → B (A causally precedes B), then HLC(A) < HLC(B). But the converse is not guaranteed — HLC(A) < HLC(B) does not prove A caused B. When HLC timestamps are incomparable or equal, you know nothing definitive about concurrency. Vector clocks explicitly represent the causal history of each event: if neither V(A) ≤ V(B) nor V(B) ≤ V(A) component-wise, the events are definitively concurrent. This is the fundamental tradeoff: vector clocks grow O(N) in the number of nodes but provide full concurrency detection; HLCs are fixed-size (two numbers) but sacrifice explicit concurrency detection.
Question 3 True / False
HLC timestamps are fixed-size (two numbers) regardless of how many nodes are in the distributed system, whereas vector clock size grows linearly with the number of nodes.
TTrue
FFalse
Answer: True
A vector clock must track one counter per node in the system, so V ∈ ℤᴺ for an N-node system. An HLC timestamp is always just two values: the physical part (max observed wall-clock time) and the logical counter (a tiebreaker). This fixed size makes HLCs practical in large distributed systems — a vector clock in a 10,000-node system would be enormous per event, while an HLC remains just two integers. The cost is losing the ability to explicitly detect concurrency, but for many applications (transaction ordering, snapshot isolation) the causal ordering guarantee is sufficient.
Question 4 True / False
Because the physical component of an HLC timestamp reflects the node's wall-clock time, you can use HLC timestamps to determine the exact wall-clock moment when any given event occurred, to within NTP precision.
TTrue
FFalse
Answer: False
The HLC physical part is not the wall-clock time of the event itself — it is the maximum wall-clock time observed across all causally preceding events (via the 'max' rule). An event's HLC physical part may be higher than the node's actual wall clock at the moment the event occurred, because it inherited a higher physical time from a received message. The HLC timestamp is bounded within the clock skew of real physical time (typically milliseconds with NTP), but it represents the highest observed physical time along the causal path, not a precise timestamp of when the event happened.
Question 5 Short Answer
Explain why the 'max' rule in HLC update — taking the maximum of the receiver's current physical part, the sender's physical part, and the local wall clock — is essential for both the Lamport causal ordering property and the bounded skew from real time.
Think about your answer, then reveal below.
Model answer: The max rule serves two goals simultaneously. For causal ordering: by inheriting the sender's physical part (or the receiver's own if higher), the physical component never decreases along causal chains. When the physical parts are equal, the logical counter increments to break the tie, ensuring HLC(cause) < HLC(effect). This gives the Lamport property. For bounded skew: because the local wall clock is always included in the max, the physical part can never fall behind real time by more than the clock drift since the last clock synchronization. Even if a causally isolated node hasn't communicated recently, its HLC physical part advances with its own wall clock, staying within the NTP skew bound of real time.
Without taking the max of the local wall clock, the physical part could stagnate if a node is causally isolated. Without taking the max of the sender's physical part, causal monotonicity would break when the sender has a faster clock. Both components of the max are necessary.