Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 3.37 KB

File metadata and controls

43 lines (29 loc) · 3.37 KB

Engineering Notes: Simulation vs. Real-World Protocols

This document outlines the simplifications and shortcuts taken in the mininet-sim implementation compared to actual real-world production protocols. This is intended to serve as reference material for interviews and deep technical deep-dives.


1. Sliding Window Transport: GBN vs. TCP

While our Go-Back-N (GBN) implementation ensures reliable, in-order packet delivery, real-world TCP differs in several crucial areas:

A. Sequence Numbers and Window Unit

  • mininet-sim GBN: Sequence numbers are integer packet counts (0, 1, 2, ...) wrapping around at $2N$. The sliding window advances on packet boundaries.
  • Real TCP: Sequence numbers correspond to bytes, not packets. Every byte in the data stream is numbered. The window size represents the number of bytes allowed in-flight (controlled by the receiver's window advertisement and congestion window).

B. Selective Repeat vs. Go-Back-N

  • mininet-sim GBN: If packet $i$ is lost, the receiver discards all subsequent packets ($i+1, i+2, ...$), forcing the sender to retransmit the entire window starting from $i$ on timeout or fast-retransmit.
  • Real TCP: Uses Selective Acknowledgement (SACK). The receiver buffers out-of-order segments and reports exactly which blocks are missing. This avoids retransmitting correctly received out-of-order packets.

C. Congestion Control

  • mininet-sim GBN: No congestion control is implemented. The sender transmits at maximum window capacity without checking network congestion or bottleneck buffer capacity.
  • Real TCP: Uses sophisticated algorithms (e.g., Tahoe, Reno, BBR, Cubic) utilizing Slow Start, Congestion Avoidance, AIMD (Additive Increase / Multiplicative Decrease), and fast recovery to adjust the sending rate dynamically to match available bandwidth.

D. Connection Establishment and Teardown

  • mininet-sim GBN: Relies on a simplified single FIN flag to close the stream. There is no active connection handshake (SYN / SYN-ACK / ACK) or structured TIME-WAIT state machine.
  • Real TCP: Relies on a rigorous three-way handshake for initialization and a four-way handshake for graceful termination.

2. Distance Vector Routing: MiniNet DV vs. RIP

Our Distance Vector routing protocol mimics the core computation of Bellman-Ford, but differs from standard Routing Information Protocol (RIP/RIPv2):

A. Communication Protocol

  • mininet-sim DV: Runs on top of our in-process virtual link layer. Packets are dispatched via memory buffer queues using asyncio tasks.
  • Real RIP: Operates as an application-layer daemon sending updates encapsulated inside UDP datagrams on port 520.

B. Infinity Cost & Network Scale

  • mininet-sim DV: Infinity is represented by float('inf'). This allows networks of arbitrary cost/hop sizes to converge.
  • Real RIP: Defines infinity as 16 hops. This caps the maximum diameter of a RIP network to 15 hops, limiting count-to-infinity loop resolution rounds to 16 cycles but making it unusable for large networks.

C. Triggered Updates vs. Periodic Broadcasts

  • mininet-sim DV: Fully periodic (every 2.0 seconds).
  • Real RIP: Employs triggered updates (immediate broadcast when a route change is detected) to dramatically speed up convergence and limit count-to-infinity duration, alongside periodic 30-second sweeps.