4.3.5Computer Networks

Ethernet (IEEE 802.3) — CSMA - CD, frame format

1,959 words9 min readdifficulty · medium

WHY does CSMA/CD exist?

WHAT problem: In classic (half-duplex) Ethernet, many stations share one broadcast medium. Only one frame can occupy the wire at a time. If two stations transmit simultaneously, their signals overlap → garbage → a collision. We need a rule for who talks when without a central controller.

WHY this approach: There is no manager handing out turns. So we make every station follow the same decentralized etiquette. The name decodes the etiquette:

  • CS = Carrier Sense → listen first; transmit only if the medium is idle.
  • MA = Multiple Access → all stations share the same medium equally.
  • CD = Collision Detection → keep listening while sending; if you detect a collision, abort immediately to stop wasting the wire.

HOW does a station know a collision happened? — The key constraint

Let TpT_p = one-way propagation delay (end to end). The round-trip worst case is 2Tp2T_p. For the sender to still be transmitting when the collision returns:

Ttransmit    2TpT_{transmit} \;\ge\; 2T_p

Derive the minimum frame size from first principles. Transmission time of a frame of LL bits at bandwidth BB (bits/s) is Ttransmit=L/BT_{transmit} = L/B. Substitute:

LB2TpLmin=2TpB\frac{L}{B} \ge 2T_p \quad\Longrightarrow\quad \boxed{L_{min} = 2 \cdot T_p \cdot B}


Binary Exponential Backoff — WHY randomized & exponential

After the nn-th collision, pick random KK uniformly from {0,1,,2n1}\{0,1,\dots,2^n - 1\}, then wait K×K \times slot time (slot time =2Tp= 2T_p, the worst-case round trip).

K{0,1,,2min(n,10)1},wait=K×(slot time)K \in \{0,1,\dots,2^{\min(n,10)}-1\}, \quad \text{wait} = K \times (\text{slot time})

  • nn is capped at 10 (window stops growing at 0..10230..1023).
  • After 16 collisions → abort.

Ethernet (IEEE 802.3) Frame Format

Figure — Ethernet (IEEE 802.3) — CSMA - CD, frame format

Why min data = 46? Frame minimum (DA+SA+Len+Data+FCS) must be 64 bytes: 6+6+2+46data+4=64 bytes (the CSMA/CD requirement!)6+6+2+\underbrace{46}_{\text{data}}+4 = 64 \text{ bytes (the CSMA/CD requirement!)} Why max data = 1500? A design tradeoff: big enough for efficiency, small enough to bound buffer/latency. Max frame (no preamble/SFD) =6+6+2+1500+4=1518= 6+6+2+1500+4 = 1518 bytes.


Flashcards

What do the letters in CSMA/CD stand for?
Carrier Sense, Multiple Access / Collision Detection
Why must Ethernet have a minimum frame size?
So the sender is still transmitting when a worst-case collision echo returns (Ttx2TpT_{tx} \ge 2T_p), guaranteeing detection.
Formula for minimum frame length?
Lmin=2TpBL_{min} = 2 T_p B = (round-trip time) × bandwidth.
Minimum and maximum Ethernet frame sizes (DA→FCS)?
64 bytes and 1518 bytes.
Why is minimum data field 46 bytes?
6+6+2+46+4 = 64 = minimum frame size required by CSMA/CD.
What is the jam signal and why send it?
A 32-bit signal sent on detecting a collision so ALL stations are sure to notice the collision.
Binary exponential backoff range after n-th collision?
K chosen uniformly from {0,...,2^min(n,10)−1}, wait = K × slot time.
After how many collisions does a station give up?
16 attempts.
Purpose of Preamble vs SFD?
Preamble (7B, 10101010…) syncs receiver clock; SFD (1B, 10101011) marks exact frame start.
How is Length distinguished from Type in the 2-byte field?
≤1500 = length; ≥1536 (0x0600) = EtherType.
Is the preamble counted in the 64-byte minimum?
No — only DA through FCS counts.

Recall Feynman: explain to a 12-year-old

Imagine one walkie-talkie channel shared by a whole class. The rule: listen first — if someone's talking, wait. If it's quiet, talk. But sound takes time to reach the far wall, so two kids might start at the same moment without hearing each other → their words crash into noise. To make sure you notice the crash, you must keep talking long enough for the garble to come back to you — that's why every message must be at least a certain length. When you do crash, you both shout "STATIC!" (the jam) so everyone stops, then each rolls a dice for how long to stay quiet. Crash again? Roll a bigger dice. After too many crashes, give up.


Connections

  • CSMA-CA — wireless variant (802.11): avoids collisions since you can't listen-while-sending on radio.
  • ALOHA and Slotted ALOHA — ancestor without carrier sensing; CSMA improves it.
  • Propagation Delay vs Transmission Delay — the core timing behind Lmin=2TpBL_{min}=2T_pB.
  • CRC and Error Detection — how the FCS field works.
  • MAC Addresses — structure of the 6-byte addresses.
  • Switched vs Shared Ethernet — full-duplex switches make CSMA/CD obsolete in modern LANs.

Concept Map

two senders overlap

needs rule for who talks

CS listen first

MA equal sharing

CD listen while sending

abort with 32-bit jam

wait then retry

give up after 16 tries

sender must still transmit

derive L/B >= 2Tp

10 Mbps, 51.2 us

Shared medium half-duplex

Collision garbles data

CSMA-CD protocol

Carrier Sense

Multiple Access

Collision Detection

Jam signal

Binary exponential backoff

Report error

Ttransmit >= 2Tp

Lmin = 2 Tp B

64 bytes min frame

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, Ethernet ka basic idea ek hi shared wire pe sab computers baithe hain, jaise ek hi walkie-talkie channel pe poori class. Rule simple hai: pehle suno (Carrier Sense) — agar koi bol raha hai to ruk jao, agar shaant hai to bolo. Lekin signal ko wire mein travel karne mein time lagta hai, isliye do log ek saath bina ek doosre ko sune transmit kar sakte hain — ye collision hai. Collision ko pakadne ke liye, sender ko itni der tak transmit karte rehna padta hai ki collision ka "echo" wapas aa jaaye. Yahi reason hai ki frame ka minimum size 64 bytes rakha gaya — formula Lmin=2TpBL_{min} = 2 T_p B se aata hai (round-trip time × bandwidth).

Jab collision detect hota hai, station ek 32-bit jam signal bhejta hai taaki sab ko pakka pata chal jaaye, phir binary exponential backoff se random wait karta hai. Pehli baar K ∈ {0,1}, doosri baar {0,1,2,3}, har collision pe window double — kyunki agar dobara takkar hui matlab traffic zyada hai, to wait ka range bada karo. 16 baar fail hua to give up.

Frame format yaad rakhna easy hai: Preamble (clock sync), SFD (start mark), Destination MAC, Source MAC, Length/Type, Data (46–1500, pad karke 46 minimum), aur FCS (CRC-32 error check). Preamble aur SFD frame ke 64-byte count mein nahi aate — sirf sync ke liye hain. Exam mein numerical aksar yahi poochta hai: diya hua bandwidth aur cable length se LminL_{min} nikaalo — bas TpT_p nikaalo, 2 se multiply karo, phir B se multiply. Bas itna!

Go deeper — visual, from zero

Test yourself — Computer Networks