šŸŽ“ BookMCQ
← Back to 24. Transport Layer Protocols

šŸ“ TCP timers RTO persistence keepalive TIME-WAIT (23 MCQs)

Timers Supporting Reliable Connection Operation

TCP uses timers to manage retransmission, zero-window probing, idle-connection checks, and connection-state cleanup. The retransmission timeout (RTO) detects missing acknowledgments; the persist mechanism probes a zero window; keepalive can test an idle peer when enabled; and TIME-WAIT is a state with a defined waiting period rather than a general-purpose timer for data delivery. It defines the boundary between application processes and packet delivery.

Different Failure and Waiting Conditions Need Different Timers

One timer cannot safely handle every TCP waiting condition. Loss of data requires retransmission, a lost window update can otherwise stall a sender indefinitely, and an idle peer may disappear without a FIN. Delayed duplicate segments also require protection after close. TCP's distinct mechanisms address these cases without treating every delay as packet loss.

RTO Estimation, Window Probes and State Expiry

TCP estimates round-trip time and variation to calculate an RTO, then retransmits outstanding data when it expires. When the peer advertises a zero window, persist probing checks whether it has reopened. Keepalive probes may test an idle connection according to implementation settings. TIME-WAIT retains state for a period commonly described as 2MSL.

A Zero Window and a Lost Window Update

Suppose a receiver advertises a zero-byte window because its buffer is full. It later frees space and sends an update, but that update is lost. The sender's persist mechanism sends a probe; the peer's response reports the current window, allowing data transfer to resume without waiting for a new application connection.

Timer Trade-Offs and Operational Behaviour

RTO estimation balances recovery speed against spurious retransmissions caused by variable delay. Persist probes prevent deadlock but add traffic, while keepalive consumes packets and is commonly configurable rather than a universal application-liveness guarantee. TIME-WAIT consumes temporary state but protects a reused connection tuple from delayed duplicate segments. Actual performance also depends on path conditions and implementation.

Misunderstandings About TCP Timer Purposes

'Keepalive retransmits lost data' is false: the RTO handles data retransmission. 'Persist means the connection has failed' is false: it probes a zero window. 'TIME-WAIT is the retransmission timeout' is false: it is a post-close state that protects sequence-space reuse and permits final segment handling. These distinctions separate similar mechanisms that are often confused.

Exam Focus: Match Each Timer to Its Trigger

Given a scenario, select RTO for unacknowledged data, persist for a zero receive window, keepalive for configured idle-peer probing, and TIME-WAIT for post-close protection. Explain why these mechanisms are separate. Avoid assuming one universal keepalive interval or treating 2MSL as the ordinary data retransmission timeout. Use the assumptions stated in each question when calculating.

Key Terms for TCP Timers: RTO, Persistence, Keepalive and TIME-WAIT

  • RTO - Retransmission timeout for unacknowledged data.
  • Persist - Probes a peer advertising zero window.
  • Keepalive - Optional probe for an idle peer.
  • TIME-WAIT - Post-close state protecting tuple reuse.
  • RTT - Measured round-trip time.
  • 2MSL - Traditional TIME-WAIT duration model.
7
Easy
11
Medium
5
Hard

šŸ“ All TCP timers RTO persistence keepalive TIME-WAIT MCQs

Q1. What is the default initial retransmission timeout (RTO) value used by TCP in most operating systems?

A.1 second āœ…
B.3 seconds
C.500 ms
D.2 seconds
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: The initial RTO is commonly set to one second in most TCP stacks. This value provides a balance between responsiveness and avoiding premature retransmissions. While implementations can adjust it, the standard default of one second is widely documented and forms the baseline for RTT‑based calculations.

Q2. Which TCP timer is responsible for ensuring that a zero‑window condition does not deadlock a connection?

A.Time‑Wait
B.Keep‑Alive
C.Retransmission
D.Persist āœ…
šŸ’” Difficulty: easy | āœ… Correct: D

šŸ“– Explanation: The Persist timer is designed to probe a receiver that has advertised a zero window. By periodically sending small packets, it prevents the connection from stalling indefinitely, unlike the other timers which handle different aspects such as connection termination, keep‑alive checks, or packet retransmission.

Q3. If a TCP sender observes a sudden increase in round‑trip time (RTT) variance, which of the following outcomes is most likely for the retransmission timeout (RTO)?

A.RTO decreases
B.RTO increases āœ…
C.RTO remains unchanged
D.RTO is set to a fixed value
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: TCP computes RTO as SRTT plus four times the RTT variance. When variance spikes, the added term grows, causing the RTO to increase. This larger timeout helps accommodate the more unpredictable network conditions, reducing the chance of unnecessary retransmissions.

Q4. Suppose a TCP connection is in the FIN‑WAIT‑2 state and the peer never sends a FIN. Which timer will eventually cause the connection to be closed, and why?

A.Time‑Wait
B.Keep‑Alive
C.2‑MSL āœ…
D.Persist
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: The 2‑MSL (twice the maximum segment lifetime) timer is used to ensure that any delayed duplicate segments are allowed to expire before the local port is released. In FIN‑WAIT‑2, if the remote FIN never arrives, the 2‑MSL timer will eventually expire, forcing the closure.

Q5. How does the purpose of the Persist timer differ from that of the Keep‑Alive timer in TCP?

A.Persist probes a zero‑window to resume data flow, while Keep‑Alive checks idle connection health āœ…
B.Both perform the same function
C.Persist terminates idle connections
D.Keep‑Alive manages flow control
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: Persist is activated when a receiver advertises a zero window; it sends small probe packets to see if the window has opened. Keep‑Alive, on the other hand, is an optional mechanism that periodically sends a segment on an otherwise idle connection to verify that the peer is still reachable.

Q6. When a TCP segment is lost and the sender retransmits after the RTO expires, what is the most direct effect on the Smoothed RTT (SRTT) estimate?

A.SRTT is reset to zero
B.SRTT is halved
C.SRTT is unchanged
D.SRTT is updated using the new measured RTT, which may be larger āœ…
šŸ’” Difficulty: medium | āœ… Correct: D

šŸ“– Explanation: The SRTT is continuously refined using the most recent RTT measurement. When a retransmission occurs, the measured RTT for that segment (often larger due to delay) is incorporated, causing the SRTT to adjust upward, reflecting the new network conditions.

Q7. If a TCP connection experiences persistent zero‑window advertisements from the receiver, how does the Persist timer influence the sender’s behavior?

A.Sender immediately aborts
B.Sender periodically sends small probe packets to test if window has opened āœ…
C.Sender ignores zero‑window and continues sending
D.Sender switches to UDP
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: When the receiver’s advertised window is zero, the Persist timer triggers the sender to emit tiny probe segments at calculated intervals. These probes check whether the receiver has opened space in its buffer, allowing the sender to resume normal data transmission once the window is non‑zero.

Q8. Consider a scenario where the Retransmission timer fires multiple times for the same segment, each time doubling the timeout interval (exponential backoff). How does this behavior affect network congestion and why?

A.It reduces congestion by sending fewer packets
B.It has no impact on congestion
C.It mitigates congestion by spacing out retransmissions, allowing network to recover āœ…
D.It worsens congestion by increasing traffic bursts
šŸ’” Difficulty: hard | āœ… Correct: C

šŸ“– Explanation: Exponential backoff lengthens the interval between successive retransmissions, giving the network time to clear queues and recover from congestion. By spacing out attempts, it lessens the chance of adding to existing overload, which is why TCP adopts this strategy to promote stability.

Q9. Given a measured RTT of 120 ms and an RTT variance of 30 ms, what is the RTO calculated using the standard TCP formula RTO=SRTT+4ƗRTTVAR\text{RTO}= \text{SRTT} + 4 \times \text{RTTVAR}?

A.240 ms āœ…
B.150 ms
C.300 ms
D.180 ms
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: Plugging the values into the formula: SRTT = 120 ms and RTTVAR = 30 ms, so 4 × 30 ms = 120 ms. Adding these gives an RTO of 120 ms + 120 ms = 240 ms. This computation reflects how TCP adds a safety margin based on observed variance.

Q10. A TCP sender sets the Keep‑Alive timer to its default of 7200 seconds. If the connection remains idle for exactly this period, what action will the sender take?

A.Close connection silently
B.Send FIN
C.Reset connection
D.Send a keep‑alive probe to elicit an ACK āœ…
šŸ’” Difficulty: medium | āœ… Correct: D

šŸ“– Explanation: When the Keep‑Alive timer expires after the default 7200 seconds of inactivity, the sender transmits a keep‑alive probe segment. If the remote endpoint responds with an ACK, the connection is deemed alive; otherwise, after a configurable number of unanswered probes, the connection may be terminated.

Q11. Which of the following best distinguishes the Time‑Wait state from the FIN‑WAIT‑2 state in terms of their primary purpose?

A.Time‑Wait handles data retransmission
B.Time‑Wait ensures all delayed packets are cleared before closing āœ…
C.FIN‑WAIT‑2 manages flow control
D.FIN‑WAIT‑2 monitors keep‑alive
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Time‑Wait exists after a side actively closes a connection; it waits for twice the maximum segment lifetime to ensure any stray packets are discarded before the port is reclaimed. FIN‑WAIT‑2, by contrast, waits for the remote FIN after having sent its own, focusing on the peer’s termination rather than packet cleanup.

Q12. If the Persist timer interval is set too short, what unintended side effect might occur on a high‑latency network?

A.Increased throughput
B.Reduced latency
C.Excessive probe packets causing unnecessary traffic āœ…
D.Faster connection termination
šŸ’” Difficulty: hard | āœ… Correct: C

šŸ“– Explanation: A short Persist interval causes the sender to issue probe packets very frequently. On a network with high latency, these probes can accumulate, generating extra traffic that does not contribute to data transfer and may exacerbate congestion, defeating the timer’s original purpose.

Q13. How do the Retransmission timer and the Persist timer cooperate to maintain a reliable TCP connection when the receiver’s advertised window temporarily drops to zero?

A.Retransmission timer handles lost data while Persist probes the zero‑window to resume transmission āœ…
B.Both timers duplicate each other’s function
C.Persist replaces Retransmission entirely
D.Neither timer is used in this situation
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: When the window closes, the Persist timer periodically sends tiny probes to see if the receiver has opened space. Meanwhile, any lost segments continue to be governed by the Retransmission timer, which ensures reliability. The two timers thus address different aspects of the problem without interfering with each other.

Q14. Which statement accurately reflects the variation in default Persist timer values among common operating systems?

A.All systems use 5 seconds
B.Linux uses 30 seconds while Windows uses 5 seconds
C.Windows disables Persist timer
D.Values differ: Linux typically 5 seconds, Windows ~5‑10 seconds, BSD ~5 seconds āœ…
šŸ’” Difficulty: medium | āœ… Correct: D

šŸ“– Explanation: Different TCP implementations choose slightly different default intervals for the Persist timer. Linux traditionally uses a 5‑second interval, Windows often defaults to a range around 5‑10 seconds, and BSD variants also default near 5 seconds. These variations reflect design choices but generally aim for similar probing behavior.

Q15. Disabling the TCP Keep‑Alive mechanism on a server will most likely result in which of the following?

A.Faster data transfer
B.Stale connections persisting indefinitely āœ…
C.Reduced retransmissions
D.Increased congestion
šŸ’” Difficulty: medium | āœ… Correct: B

šŸ“– Explanation: Keep‑Alive provides a way to detect dead peers on idle connections. If it is disabled, the server will not send periodic probes, so a connection that silently fails will remain in the ESTABLISHED state indefinitely, potentially consuming resources and causing management difficulties.

Q16. Compared to a linear backoff strategy, exponential backoff for the Retransmission timer tends to:

A.Increase overall latency
B.Decrease packet loss
C.Reduce network congestion by quickly expanding timeout intervals āœ…
D.Have no effect on congestion
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: Exponential backoff doubles the timeout after each failure, rapidly enlarging the interval between retransmissions. This swift growth helps to alleviate congestion by preventing a burst of repeated attempts, whereas a linear increase would grow more slowly and could continue to add load to an already congested network.

Q17. Why does TCP wait for twice the maximum segment lifetime (2 MSL) in the TIME‑WAIT state before releasing a port?

A.To ensure delayed duplicate segments are discarded āœ…
B.To increase throughput
C.To speed up connection closure
D.To synchronize clocks
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: The 2 MSL wait guarantees that any stray packets still traversing the network are given enough time to expire. Only after this period is the port considered safe to reuse, preventing old duplicate segments from being mistakenly associated with a new connection.

Q18. If a TCP connection simultaneously experiences a zero‑window condition, a lost ACK, and an idle period exceeding the Keep‑Alive interval, which timers will be active and what order will they likely fire?

A.Only Persist
B.Only Keep‑Alive
C.Only Retransmission
D.Persist probes, Retransmission backs off, then Keep‑Alive sends probe after idle timeout āœ…
šŸ’” Difficulty: medium | āœ… Correct: D

šŸ“– Explanation: In this complex state, the Persist timer is active to test the zero‑window, the Retransmission timer backs off after the lost ACK, and the Keep‑Alive timer remains dormant until the idle period elapses, at which point it sends its probe. Thus, the timers operate concurrently but fire in the described sequence.

Q19. After a sudden RTT spike to 500 ms following several stable RTT measurements of 100 ms, how should the TCP sender adjust its RTO to balance prompt retransmission and congestion avoidance?

A.Set RTO to 100 ms
B.Increase RTO to reflect higher variance āœ…
C.Keep RTO unchanged
D.Decrease RTO to speed up recovery
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: A large RTT spike raises the measured variance dramatically. TCP reacts by increasing the RTO, incorporating the higher RTTVAR term, which prevents premature retransmissions that could worsen congestion while still allowing eventual recovery if the network stabilizes.

Q20. What is the most likely consequence of disabling the Persist timer on a TCP sender that frequently encounters zero‑window advertisements?

A.Immediate connection termination
B.Unlimited data flow
C.Sender may deadlock waiting for window update āœ…
D.Faster data transmission
šŸ’” Difficulty: medium | āœ… Correct: C

šŸ“– Explanation: Without Persist, the sender has no mechanism to probe a zero‑window receiver. Consequently, it may wait indefinitely for the window to open, effectively deadlocking the connection and halting data transfer until the application on the receiver side changes the window size.

Q21. How does TCP Keep‑Alive differ from an application‑layer heartbeat mechanism?

A.Keep‑Alive is optional low‑overhead probe at the transport layer, while application heartbeats are custom and often carry payload āœ…
B.Both are identical
C.Keep‑Alive guarantees connection liveness
D.Application heartbeats replace Keep‑Alive
šŸ’” Difficulty: easy | āœ… Correct: A

šŸ“– Explanation: Keep‑Alive operates at the TCP layer, sending a minimal segment (often just an ACK) to test whether the peer is reachable, and it is optional. Application‑layer heartbeats are implemented by the software, can include meaningful data, and are independent of TCP’s built‑in probes.

Q22. During a network outage, a TCP connection's Retransmission timer expires several times while the Persist timer is also active due to a zero‑window condition. Which timer ultimately determines when the connection will be aborted, assuming no recovery?

A.Keep‑Alive
B.Time‑Wait
C.2 MSL
D.The timer that reaches its maximum retry limit first (often Retransmission), leading to abort āœ…
šŸ’” Difficulty: hard | āœ… Correct: D

šŸ“– Explanation: Both timers may be running, but the one that exhausts its allowed number of retries first will trigger the abort. In practice, the Retransmission timer has a defined maximum number of attempts; once exceeded, the connection is terminated regardless of the Persist timer’s state.

Q23. If a TCP implementation uses a coarse‑grained timer resolution of 500 ms, how might this affect the accuracy of the Retransmission timeout and overall performance?

A.Improves accuracy
B.May cause RTO to be rounded up, leading to slower retransmissions āœ…
C.Has no impact
D.Decreases memory usage
šŸ’” Difficulty: hard | āœ… Correct: B

šŸ“– Explanation: A coarse timer means the calculated RTO is rounded to the nearest 500 ms interval. This often results in a slightly larger timeout than the precise value, causing retransmissions to be delayed and potentially reducing responsiveness, especially on fast networks where finer granularity is beneficial.

šŸ”— Related Topics (MCQs)