› Module 4: The Data Link Layer › 4.2 Flow Control (Stop-and-Wait vs Sliding Window)
M O D U L E

Module 4: The Data Link Layer

Framing, error detection (CRC, Hamming), flow control, CSMA/CD MAC protocols, and Ethernet

4.1 Framing and Error Detection (Parity, Checksum, CRC, Hamming)

The Data Link Layer (DLL) transforms the raw physical bit stream into structured Frames and ensures error-free node-to-node transmission across a single physical link.

Error Detection & Correction Mechanisms

  • Parity Check: Appends a single parity bit (even or odd). Detects single-bit errors; fails completely if an even number of bits are flipped.
  • Internet Checksum: Segments data into 16-bit integers, sums them using 1's complement arithmetic, and appends the inverted sum. Commonly used in IP, TCP, and UDP.
  • Cyclic Redundancy Check (CRC): Treats data as a polynomial bit string and performs modulo-2 binary division by a generator polynomial $G(x)$. The remainder is appended as the Frame Check Sequence (FCS). Catches all burst errors $le$ degree of $G(x)$ (standard in Ethernet IEEE 802.3).
  • Hamming Code: An error-correcting code that calculates redundant parity bits placed at powers-of-two bit positions ($1, 2, 4, 8...$). If $2^r ge m + r + 1$, the receiver can pinpoint and correct any single-bit flip without requiring retransmission.

4.2 Flow Control (Stop-and-Wait vs Sliding Window)

Flow Control prevents a fast sending network node from overwhelming a slower receiver's finite buffer space with frames.

Figure 4.1: Flow Control: Stop-and-Wait vs Sliding Window Protocol Stop-and-Wait Protocol Sender waits for ACK before sending next Sender Receiver Frame 1 ACK 1 Frame 2 ACK 2 Sliding Window (Pipelined) Multiple frames in flight before ACK Sender Receiver Window = 4 Frames sent Cumulative ACKs return

Figure 4.1: Flow control protocols: Stop-and-Wait limits throughput to 1 frame per RTT; Sliding Window pipelines multiple frames continuously.

4.3 Medium Access Control (ALOHA, CSMA/CD, CSMA/CA)

When multiple nodes share a broadcast channel (like a coaxial bus or radio airwaves), Medium Access Control (MAC) sublayer protocols decide which node may transmit, preventing or recovering from packet collisions.

Figure 4.2: CSMA/CD (Carrier Sense Multiple Access with Collision Detection) Procedure Station Wants to Transmit Sense Channel: Is it IDLE? NO (Busy): Wait YES Start Transmitting Frame Keep listening for Collision during tx No Collision Detected Success • Transmission Done Collision Detected! 1. Send JAM Signal 2. Exponential Backoff & Retry

Figure 4.2: The CSMA/CD algorithm used in classic Ethernet: carrier sense, transmit, detect collisions, send jam signal, and back off.

4.4 Ethernet (IEEE 802.3) and MAC Addressing

Ethernet is the dominant family of wired Local Area Network technologies standardized under IEEE 802.3. Every network interface card (NIC) is burned with a globally unique 48-bit (6-byte) physical MAC Address.

-- 48-bit MAC Address Format (Hexadecimal notation):
-- Example: 00:1A:2B:3C:4D:5E
-- [ First 24 bits: OUI (Organizationally Unique Identifier - Manufacturer) ]
-- [ Last 24 bits:  NIC Specific Serial Number assigned by vendor          ]

Address Resolution Protocol (ARP): Maps an IP address (Layer 3) to a physical MAC address (Layer 2) on the same local network by sending an ARP Broadcast request (Who has IP X.X.X.X?) and receiving a unicast ARP reply.

MODULE COMPREHENSIVE QUIZ

Module 4 Final Quiz

Test your understanding across all 4 topics of this module with interview-grade questions, tricky edge cases, and code output predictions.

Take Module 4 Final Quiz →
Yukti Mascot