Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Computer Networks  Module 4 – Medium access control and Ethernet

CSMA/CD and Ethernet timing

How CSMA/CD shares a cable: carrier sense, collision detection and binary exponential backoff, the 64-byte minimum frame, efficiency and full duplex.

  • Intermediate
  • 30 minutes
  • Examples run with Python 3.14.8 and Pyodide 314.0.7
  • By MySmartCoPilot
Free lesson, Pro answers: 30 minutes
Free: the whole lesson. With a pass: the model answers to its 2 interview questions.

What you will learn

  • Explain carrier sense, collision detection and binary exponential backoff
  • Calculate the minimum frame size from link rate and round-trip propagation time
  • Compute CSMA/CD efficiency from propagation and transmission times
  • Explain why full-duplex switched Ethernet no longer uses CSMA/CD

Before you start

What you’ll learn · Before you start

What you will learn

  • Explain carrier sense, collision detection and binary exponential backoff
  • Calculate the minimum frame size from link rate and round-trip propagation time
  • Compute CSMA/CD efficiency from propagation and transmission times
  • Explain why full-duplex switched Ethernet no longer uses CSMA/CD

Before you start

On this page

The original 10 Mb/s budget combines 46.38 microseconds of round-trip delays with 4.8 microseconds of jam time. Compare that 51.18-microsecond total with the 512-bit-time slot, then inspect the original backoff and efficiency models.

Carrier sensing cannot remove propagation uncertainty

CSMA/CD (carrier sense multiple access with collision detection) is how classic Ethernet let many computers share one cable. Three rules make it up. A station listens before it sends and waits while the cable is busy (carrier sense). It keeps listening while it sends and stops as soon as it hears another signal (collision detection). After a collision it waits a random number of slot times, and the range doubles with every further collision (binary exponential backoff). One timing rule follows from the physics: a sender must still be transmitting when news of a collision gets back from the far end, which is why an Ethernet frame is at least 64 bytes long. Today’s switched links are full duplex, with nothing shared and so nothing to collide, and CSMA/CD survives only as a half-duplex mode in the standard.

The ALOHA lesson showed what random access costs when stations send blindly: at most 18.4 % or 36.8 % of the channel gets through. On a cable a station can do better, because it can hear whether anyone else is sending. Robert Metcalfe added this carrier sense to the ALOHA idea when he designed Ethernet at Xerox PARC, and Leonard Kleinrock and Fouad Tobagi analysed several versions of it in a paper of their own. The versions differ in what a station does when it finds the channel busy:

  • 1-persistent: wait until the channel goes quiet, then send at once. Ethernet works this way: after the last bit of a passing frame it waits the interframe gap, 9.6 µs at 10 Mb/s, and starts sending if it has a frame.
  • Non-persistent: back off for a random time and listen again, which wastes some idle time but avoids a pile-up of stations that were all waiting for the same frame to end.
  • p-persistent: on a slotted channel, send in the first idle slot with probability p, otherwise wait a slot.

Listening cannot prevent every collision, because a signal takes time to travel. A station that hears silence is hearing the past: another station may have started a moment ago, and its first bit is still on its way down the cable. Once a frame’s first bit has reached every station, everyone defers to it, so collisions can only happen in that first stretch, one one-way propagation time long. That is why carrier sense does so much better than ALOHA when the propagation time is small compared with the time it takes to send a frame.

Keep local silence distinct from the arrival time of another station’s signal.

Interactive · stage by stage Carrier sensing cannot remove propagation uncertainty Keep local silence distinct from the arrival time of another station's signal.
Carrier sensing cannot remove propagation uncertainty, step 3 of 3. Showing Observed idle, Original persistence, Model limit. In focus: Model limit.Observed idleLocal signal historyOriginal persistenceWait then transmitModel limitPropagation delay

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. A station hears its local medium. Another sender's new signal may still be travelling toward it.
  2. The original one-persistent description waits for the medium and required interframe gap before attempting.
  3. A low propagation-to-transmission ratio helps the stated contention model, while physical and retry details determine actual results.

Checkpoint

Check: Carrier sensing cannot remove propagation uncertainty

  1. Question 1 of 2 Why can two carrier-sensing stations still collide?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Each can start before the other's signal reaches it

    Local silence can precede the arrival of a remote transmission. Propagation delay remains part of the medium.

  2. Question 2 of 2 The original 10 Mb/s interframe gap is 96 bit times. How many microseconds is that?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 9.6 us (anything from 9.599999999 to 9.600000001 counts)

    Each bit time is 0.1 microseconds, so 96 is 9.6.

The jam keeps a detected collision visible

Distinguish collision detection from completion of a successful data frame. The extra jam signal belongs to the failed attempt’s declared timing budget. Its receiver interpretation, length and retry behaviour follow the stated specification. A teaching model may omit physical signal details while still illustrating that budget, but it should name those omissions. Keep the original specification table and measured arithmetic beside that limited model.

A station on a cable can do one more thing that an ALOHA radio could not: notice the collision while it is still sending. The 1982 Ethernet specification of Digital, Intel and Xerox (DIX Ethernet, the basis of the IEEE 802.3 standard) has the station keep sending for at least 32 and at most 48 more bits after it detects a collision, a jam, so that the collision lasts long enough for every transmitting station to notice it. Then it stops and backs off.

Two things follow. A collision now wastes only about one round trip of the cable instead of a whole frame. And the pieces of collided frames that reach the receivers are short, so the specification tells a receiver to treat any frame of fewer than 64 octets as a collision fragment and to discard it.

Read the original 48-bit jam as part of collision detection and retry timing.

Interactive · stage by stage The jam keeps a detected collision visible Read the original 48-bit jam as part of collision detection and retry timing.
The jam keeps a detected collision visible, step 3 of 3. Showing Original specification, Maximum at 10 Mb/s, Recovery. In focus: Recovery.Original specification32 to48 jam bitsMaximum at 10 Mb/s4.8 microsecondsRecoveryStop then back off

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original DIX account gives a declared range of extra transmitted bits after collision detection.
  2. The original timing budget uses the longest 48-bit jam at a 0.1-us bit time.
  3. The station ends the failed attempt and selects its next allowed delay. The jam is not a successful data frame.

Checkpoint

Check: The jam keeps a detected collision visible

  1. Question 1 of 2 What is the jam's role in the stated collision procedure?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Keep the detected collision visible to other transmitting stations

    The extra signal supports detection of the failed attempt. The attempt has collided rather than delivering the intended payload.

  2. Question 2 of 2 The original maximum jam is 48 bits at 10 Mb/s. How many microseconds is it?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 4.8 us (anything from 4.799999999 to 4.800000001 counts)

    Forty-eight bit times at 0.1 us each give 4.8 us.

The frame must outlast the declared round-trip budget

Collision detection only works if the sender is still sending when the collision reaches it. Picture the worst case:

Space-time diagram: B starts just before A’s first bit arrives, and the collision gets back to A only after about twice the one-way delay.Station AStation Bat the far endtimeA startsA isstillsendingA's first bitB's first bit121B starts, and hears A almost at once.2The collision reaches A after almostone round trip: 2 × the one-way delay.

Why a frame must outlast the round trip

Text description of the diagram

Station A is on the left and station B at the far end of the cable on the right; time runs downwards.

  • A starts sending. Its first bit travels along the cable and reaches B after one one-way propagation delay.
  • Just before that bit arrives, B hears an idle cable and starts sending too. A moment later B hears A's signal, detects the collision and stops.
  • B's first bit now has to travel all the way back. It reaches A after almost twice the one-way delay, the round-trip time.

A only notices the collision if it is still sending when B's signal arrives, which is why the shaded bar of A's transmission must be at least one round trip long: the minimum frame time is 2 × distance ÷ signal speed.

Station A starts. Its first bit needs one one-way delay τ to reach station B at the far end. Just before it arrives, B hears an idle cable and starts too, and at once it hears A and stops. B’s signal now has to travel all the way back, and it reaches A only after almost 2τ. If A has finished its frame by then, it never learns that the frame was destroyed. So a frame must last at least one round trip:

Lmin⁡=2τR=2dRvL_{\min} = 2\,\tau\,R = \frac{2\,d\,R}{v}

where R is the bit rate, d the length of the cable and v the speed of the signal, about 2 × 10⁸ m/s in copper.

Classic Ethernet turned this into one number, the slot time of 512 bit times, 51.2 µs at 10 Mb/s. The DIX specification gives the slot three jobs at once: it is an upper bound on how long a station needs to take hold of the cable, an upper bound on the length of a collision fragment, and the unit of time for retransmissions. To do them, the slot must be longer than the collision round-trip budget: The propagation, electronics, detection and other specified delays used to determine whether a transmitting station can still detect a collision. of the largest network the rules allow, plus the longest jam. The specification’s own budget shows where the 512 bits go:

The 1982 delay budget behind the 512-bit slot Python · slot_budget.py
"""Where the 512-bit slot of 10 Mb/s Ethernet goes.

The worst-case round-trip delays of the largest network allowed by the Ethernet
Version 2.0 specification of Digital, Intel and Xerox (Table 7-1), in microseconds,
grouped by what causes them. One bit time at 10 Mb/s is 0.1 microseconds.
"""

BUDGET = {
    "cable: 1,500 m of coaxial cable": 12.99,
    "cable: 1,000 m of point-to-point links": 10.26,
    "cable: 300 m of transceiver cables": 3.08,
    "transceivers and encoders": 2.70 + 2.10 + 1.95 + 2.00,
    "repeaters and link electronics": 1.20 + 0.80 + 0.40 + 0.40,
    "carrier sense and collision detect": 1.00 + 1.00,
    "signal rise times and timer tolerance": 6.00 + 0.30 + 0.20,
}

BIT_TIME_US = 0.1
JAM_BITS = 48            # the longest jam a station may send

for part, us in BUDGET.items():
    print(f"{us:6.2f} µs  {part}")
round_trip = sum(BUDGET.values())
jam = JAM_BITS * BIT_TIME_US
cable = sum(us for part, us in BUDGET.items() if part.startswith("cable"))
print(f"{round_trip:6.2f} µs  worst-case round trip ({round_trip / BIT_TIME_US:.0f} bit times)")
print(f"{jam:6.2f} µs  plus the longest jam ({JAM_BITS} bits)")
print(f"{round_trip + jam:6.2f} µs  must fit in one slot: 512 bit times = {512 * BIT_TIME_US:.1f} µs")
print(f"cable alone is {cable:.2f} µs, {cable / round_trip:.0%} of the round trip")

Output

 12.99 µs  cable: 1,500 m of coaxial cable
 10.26 µs  cable: 1,000 m of point-to-point links
  3.08 µs  cable: 300 m of transceiver cables
  8.75 µs  transceivers and encoders
  2.80 µs  repeaters and link electronics
  2.00 µs  carrier sense and collision detect
  6.50 µs  signal rise times and timer tolerance
 46.38 µs  worst-case round trip (464 bit times)
  4.80 µs  plus the longest jam (48 bits)
 51.18 µs  must fit in one slot: 512 bit times = 51.2 µs
cable alone is 26.33 µs, 57% of the round trip

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 slot_budget.py

Only 57 % of the round trip is cable; transceivers, repeaters and the time it takes to recognise a signal take the rest. With the jam, the total, 51.18 µs, just fits in 51.2 µs. A frame of 512 bits is 64 bytes: 6 bytes of destination address, 6 of source address, 2 of type, 46 of data and 4 of frame check sequence. A shorter message is padded to 46 bytes of data, whatever the real length of the cable.

Compare the original 51.18-us total with its 51.2-us slot rather than using cable delay alone.

Interactive · stage by stage The frame must outlast the declared round-trip budget Compare the original 51.18-us total with its 51.2-us slot rather than using cable delay alone.
The frame must outlast the declared round-trip budget, step 3 of 3. Showing Cable delay, Full budget, Slot comparison. In focus: Slot comparison.Cable delayTwo-way propagationFull budget46.38 us plus 4.8 usSlot comparison51.18 versus 51.2 us

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original model needs the sender to remain active until the far-end collision information can return.
  2. The original specification table includes cable, electronics and detection delays, then the maximum jam.
  3. The original total fits just within the classic 512-bit-time slot at 10 Mb/s.

Checkpoint

Check: The frame must outlast the declared round-trip budget

  1. Question 1 of 2 What does the cable-only Lmin calculation omit?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Electronics, detection and other stated slot-budget costs

    The pure cable formula counts the round-trip signal delay. Propagation is the included term, not the omitted one.

  2. Question 2 of 2 The original slot is 512 bits. How many bytes is that?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 64 bytes

    Dividing 512 by eight gives 64 bytes.

A fixed bit slot covers less distance at a higher rate

The minimum frame grows with the bit rate, so the same cable that suits a 10 Mb/s network does not suit a faster one:

Minimum frame for three rates and two cable lengths Python · min_frame.py
"""The shortest frame that still detects every collision, cable delay only.

A sender must still be transmitting when news of a collision gets back from the
far end, so a frame needs at least 2 * distance / speed seconds on the wire:
L_min = 2 * distance * rate / speed bits. Signals travel at about 2 * 10**8 m/s.
"""
import math

SPEED = 200_000_000       # metres per second

RATES = {"10 Mb/s": 10_000_000, "100 Mb/s": 100_000_000, "1 Gb/s": 1_000_000_000}


def bits_needed(rate, distance):
    return math.ceil(2 * distance * rate / SPEED)


print("rate         200 m      2,800 m")
for name, rate in RATES.items():
    print(f"{name:9} {bits_needed(rate, 200):6,} bits  {bits_needed(rate, 2_800):7,} bits")

print()
print("cable that a slot can cover, before any electronics:")
for name, rate, slot in [("10 Mb/s", 10_000_000, 512), ("100 Mb/s", 100_000_000, 512), ("1 Gb/s", 1_000_000_000, 512), ("1 Gb/s", 1_000_000_000, 4096)]:
    print(f"  {name:9} {slot:4}-bit slot: {slot * SPEED / (2 * rate):7,.1f} m")

Output

rate         200 m      2,800 m
10 Mb/s       20 bits      280 bits
100 Mb/s     200 bits    2,800 bits
1 Gb/s     2,000 bits   28,000 bits

cable that a slot can cover, before any electronics:
  10 Mb/s    512-bit slot: 5,120.0 m
  100 Mb/s   512-bit slot:   512.0 m
  1 Gb/s     512-bit slot:    51.2 m
  1 Gb/s    4096-bit slot:   409.6 m

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 min_frame.py

At 10 Mb/s, 2.8 km of cable (the largest station separation the DIX specification allows) needs only 280 bits of round trip, comfortably inside 512. At 100 Mb/s the same distance would need 2,800 bits, so a 100 Mb/s collision domain that keeps the 512-bit slot must be about ten times smaller, and the slot covers at most 512 m of cable before any electronics are counted. At 1 Gb/s a 512-bit slot covers only 51.2 m. When the IEEE 802.3z task force designed half-duplex Gigabit Ethernet, it wanted at least 200 metres, two 100-metre runs to the desktop, and its bit budget exceeded 512 bit times even with short cables. Its answer was carrier extension: Non-data symbols that extend medium occupancy for the declared half-duplex gigabit slot budget while leaving the frame's data and FCS unchanged.: the slot became 4,096 bit times (512 bytes) at 1 Gb/s, and a short frame is followed by non-data symbols until the signal has lasted a full slot. The data and the frame check sequence stay exactly as they were, so a 64-byte frame is still a 64-byte frame.

Keep frame bytes separate from the original 4,096-bit-time medium occupancy.

Interactive · stage by stage A fixed bit slot covers less distance at a higher rate Keep frame bytes separate from the original 4,096-bit-time medium occupancy.
A fixed bit slot covers less distance at a higher rate, step 3 of 3. Showing Original 100 Mb/s, Original 1 Gb/s, Carrier extension. In focus: Carrier extension.Original 100 Mb/s512 metres cable-onlyOriginal 1 Gb/s51.2 metres cable-onlyCarrier extension4,096 bit times

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original 512-bit slot and assumed signal speed give a 512-metre cable-only round-trip bound at 100 Mb/s.
  2. At ten times the rate, the same bit slot lasts one tenth as long and covers one tenth the cable-only distance.
  3. The original half-duplex gigabit description extends occupancy with non-data symbols while retaining the original frame's data and FCS.

Checkpoint

Check: A fixed bit slot covers less distance at a higher rate

  1. Question 1 of 2 Does carrier extension add application data to the frame?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: No, it extends medium occupancy with non-data symbols

    The original frame content stays unchanged while the occupancy budget grows. Slot occupancy and user data are different quantities.

  2. Question 2 of 2 The original carrier-extension slot has 4,096 bit times versus 512. By what factor is it longer?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 8 factor

    4,096 divided by 512 is eight.

The exponent stops at ten and the attempt limit is separate

After a collision, both senders must try again, and if they both retried after the same delay they would collide again. Ethernet picks the delay at random, in whole slot times, from a range that doubles with every collision of the same frame. The DIX specification defines the wait before the n-th retransmission as a uniformly distributed random integer r with 0 ≤ r < 2^k, where k = min(n, 10); after 16 attempts, the first one and 15 retries, the station gives up and reports an error. It is called truncated backoff: A retry delay rule whose exponential choice range stops growing at a stated exponent cap, with a separate limit on attempts. because the doubling stops at 1,024 slots.

The backoff range, collision by collision Python · backoff_table.py
"""Truncated binary exponential backoff, collision by collision.

After the n-th collision of a frame, a station waits r slot times, with r drawn
uniformly from 0 .. 2**k - 1 and k = min(n, 10). After 16 attempts it gives up.
One slot time at 10 Mb/s is 512 bit times, 51.2 microseconds.
"""

SLOT_US = 51.2
BACKOFF_LIMIT = 10
ATTEMPT_LIMIT = 16


def duration(us):
    return f"{us:7.1f} µs" if us < 1000 else f"{us / 1000:7.2f} ms"


print("collision  choices  mean wait")
worst = 0
for n in range(1, ATTEMPT_LIMIT + 1):
    if n == ATTEMPT_LIMIT:
        print(f"{n:9}  the frame is dropped: excessive collisions")
        break
    choices = 2 ** min(n, BACKOFF_LIMIT)
    mean_slots = (choices - 1) / 2
    worst += choices - 1
    if n <= 4 or n >= 10:
        print(f"{n:9}  {choices:7}  {mean_slots:5.1f} slots = {duration(mean_slots * SLOT_US)}")
    elif n == 5:
        print("      ...")
print(f"longest possible total wait: {worst:,} slots = {worst * SLOT_US / 1000:.1f} ms")

Output

collision  choices  mean wait
        1        2    0.5 slots =    25.6 µs
        2        4    1.5 slots =    76.8 µs
        3        8    3.5 slots =   179.2 µs
        4       16    7.5 slots =   384.0 µs
      ...
       10     1024  511.5 slots =   26.19 ms
       11     1024  511.5 slots =   26.19 ms
       12     1024  511.5 slots =   26.19 ms
       13     1024  511.5 slots =   26.19 ms
       14     1024  511.5 slots =   26.19 ms
       15     1024  511.5 slots =   26.19 ms
       16  the frame is dropped: excessive collisions
longest possible total wait: 7,151 slots = 366.1 ms

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 backoff_table.py

After a first collision a station waits 0 or 1 slot, on average 25.6 µs at 10 Mb/s. By the tenth collision it chooses among 1,024 slots, an average wait of 26.19 ms, and in the very worst case a frame spends 7,151 slots, about 0.37 seconds, waiting before it is dropped. The specification adds that these values are the most aggressive a station may use: an implementation may wait longer, never less.

Why doubling? A collision is evidence that more than one station is competing, and each further collision suggests there are more still. The ALOHA lesson found that random access works best when each of n competitors sends in a slot with a probability of about 1/n. Doubling the range after each collision reaches a range of about n slots within a few collisions, without anyone counting the stations. The original simplified slot simulation starts several stations with one frame each, illustrating contention and range growth. It does not model every physical CSMA/CD detail or the standard sixteen-attempt drop:

Backoff with 2 to 10 stations ready at once Python · backoff_sim.py
"""Binary exponential backoff at work: n stations, one frame each, all ready at once.

Time runs in slots. A station sends when its waiting time is up; if it is the only
sender in that slot, its frame gets through (frames here last one slot), otherwise
every sender in the slot has collided and draws a new wait. The generator is
seeded, so every run prints the same numbers.
"""
import random

TRIALS = 2_000


def run(stations, rng):
    collisions = [0] * stations       # collisions each station's frame has had
    wait = [0] * stations             # slots until each station sends again
    waiting = set(range(stations))
    slot = 0
    while waiting:
        senders = [s for s in waiting if wait[s] == 0]
        if len(senders) == 1:
            waiting.discard(senders[0])
        else:
            for s in senders:
                collisions[s] += 1
                k = min(collisions[s], 10)
                wait[s] = rng.randrange(2 ** k) + 1   # + 1: the wait starts after this slot
        for s in waiting:
            if s not in senders:
                wait[s] -= 1
        slot += 1
    return slot, sum(collisions), max(collisions)


rng = random.Random(7)
print("stations  slots to finish  collisions a frame  worst frame")
for stations in [2, 3, 5, 10]:
    results = [run(stations, rng) for _ in range(TRIALS)]
    slots = sum(r[0] for r in results) / TRIALS
    per_frame = sum(r[1] for r in results) / (TRIALS * stations)
    worst = max(r[2] for r in results)
    print(f"{stations:8}  {slots:15.1f}  {per_frame:18.2f}  {worst:6} collisions")

Output

stations  slots to finish  collisions a frame  worst frame
       2              6.8                1.64       5 collisions
       3             10.7                2.03       5 collisions
       5             19.6                2.72       6 collisions
      10             48.1                3.81       7 collisions

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 backoff_sim.py

With ten stations all ready at once, every frame got through within 48 slots on average. A frame met 3.8 collisions on average and never more than 7, far from the limit of 16. The growing range also gives the backoff its weak point: a frame that has collided many times waits on average far longer than a newcomer, so under heavy load a station that has been unlucky tends to stay unlucky for a while.

Compare the capped 1,024-choice range with the separate sixteen-attempt limit.

Interactive · stage by stage The exponent stops at ten and the attempt limit is separate Compare the capped 1,024-choice range with the separate sixteen-attempt limit.
The exponent stops at ten and the attempt limit is separate, step 3 of 3. Showing First collision, Tenth and later, Attempt limit. In focus: Attempt limit.First collisionTwo choicesTenth and later1,024 choicesAttempt limitSixteen attempts

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original first collision chooses zero or one slot.
  2. The original exponent min(n,10) limits the delay range even as more collisions occur.
  3. The standard retry contract ends after its stated attempt limit. The original small simulation is a simplified finite-contention model and needs its own stated stopping behaviour.

Checkpoint

Check: The exponent stops at ten and the attempt limit is separate

  1. Question 1 of 2 Which rule limits the number of delay choices after twelve collisions?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: The exponent cap at ten

    Two to the tenth gives 1,024 choices. The original stated attempt limit is sixteen rather than ten.

  2. Question 2 of 2 The original backoff range has 1,024 integer choices starting at zero. What is its largest slot count?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 1023 slots

    The last value is 1,024 minus one.

Efficiency estimates depend on the contention model

Efficiency is the share of time the cable carries frames that get through when every station always has something to send. It depends on one ratio, the the propagation-to-frame ratio: One-way propagation time divided by frame transmission time, used with the assumptions of a stated contention-efficiency model.:

a=τTframea = \frac{\tau}{T_{\text{frame}}}

Under heavy load, each successful frame is preceded by a contention period: a run of slots, each lasting 2τ, in which stations collide until one of them gets through on its own. If the stations behave as well as they can, each such slot succeeds with a probability of about 1/e (the slotted ALOHA result), so a frame waits on average about e slots. That gives

E≈TframeTframe+2eτ=11+2ea≈11+5.44aE \approx \frac{T_{\text{frame}}}{T_{\text{frame}} + 2e\,\tau} = \frac{1}{1 + 2e\,a} \approx \frac{1}{1 + 5.44\,a}

Metcalfe and Boggs described a heavy-load model of this kind in their paper on the first Ethernet. The approximation E≈1/(1+5a)E \approx 1/(1 + 5a) is the rounded form most often quoted, and some versions also count the time the frame’s last bit needs to reach the far end, which gives 1/(1+6.44a)1/(1 + 6.44a). They all say the same thing, and a numerical question will tell you which one it wants:

Efficiency for five networks, three versions of the model Python · efficiency.py
"""CSMA/CD efficiency under heavy load, with three common versions of the model.

a = one-way propagation time / frame transmission time. Each frame waits for a
contention period of about e slots of 2 * tau before it gets the channel, which
gives E2; E1 is the rounded form, and E3 also counts the time the frame's last bit
needs to reach the far end. "Worst case" is the largest 10 Mb/s network, whose
round trip uses a whole 51.2-microsecond slot (tau = 25.6 microseconds).
"""
import math

CASES = [
    # label, rate in bit/s, one-way propagation time in microseconds, frame bytes
    ("10 Mb/s, worst case, 64 B", 10_000_000, 25.6, 64),
    ("10 Mb/s, worst case, 1518 B", 10_000_000, 25.6, 1518),
    ("10 Mb/s, 200 m, 64 B", 10_000_000, 1.0, 64),
    ("100 Mb/s, 200 m, 64 B", 100_000_000, 1.0, 64),
    ("100 Mb/s, 200 m, 1518 B", 100_000_000, 1.0, 1518),
]

print("E1 = 1/(1 + 5a)  E2 = 1/(1 + 2e·a)  E3 = 1/(1 + (2e + 1)·a)")
print()
print(f"{'':27} {'a':>5}  {'E1':>5}  {'E2':>5}  {'E3':>5}")
for label, rate, tau_us, size in CASES:
    frame_us = size * 8 / rate * 1_000_000
    a = tau_us / frame_us
    e1, e2, e3 = 1 / (1 + 5 * a), 1 / (1 + 2 * math.e * a), 1 / (1 + (2 * math.e + 1) * a)
    print(f"{label:27} {a:5.3f}  {e1:5.1%}  {e2:5.1%}  {e3:5.1%}")

Output

E1 = 1/(1 + 5a)  E2 = 1/(1 + 2e·a)  E3 = 1/(1 + (2e + 1)·a)

                                a     E1     E2     E3
10 Mb/s, worst case, 64 B   0.500  28.6%  26.9%  23.7%
10 Mb/s, worst case, 1518 B 0.021  90.5%  89.7%  88.1%
10 Mb/s, 200 m, 64 B        0.020  91.1%  90.4%  88.8%
100 Mb/s, 200 m, 64 B       0.195  50.6%  48.5%  44.3%
100 Mb/s, 200 m, 1518 B     0.008  96.0%  95.7%  95.0%

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 efficiency.py

Minimum-size frames on the largest 10 Mb/s network spend most of their time contending: about 27 %. Full-size frames on the same network reach about 90 %, and so do minimum-size frames on 200 m of cable. At 100 Mb/s over the same 200 m, the frame time shrinks ten-fold, a grows ten-fold, and minimum-size frames fall to about 50 %. Long frames and short cables keep CSMA/CD efficient; at fixed propagation time and frame size, an increased rate raises this model’s ratio and lowers its estimated efficiency.

Download Time Calculator Enter a frame size in bytes and a link rate, with the overhead set to 0 %, to get the frame's transmission time, the T in a = τ/T.

Read the original 28.6, 26.9 and 23.7 percentages as model-dependent estimates.

Interactive · stage by stage Efficiency estimates depend on the contention model Read the original 28.6, 26.9 and 23.7 percentages as model-dependent estimates.
Efficiency estimates depend on the contention model, step 3 of 3. Showing Original ratio, Rounded model, Other models. In focus: Other models.Original ratioa=0.5Rounded modelE1=28.6 percentOther models26.9 and 23.7 percent

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original minimum-frame worst-case fixture gives propagation time half the frame transmission time.
  2. Using 1/(1+5a) gives 28.6 percent for that original ratio.
  3. The original 2e and 2e+1 denominator models yield different estimates under their stated contention and propagation accounting.

Checkpoint

Check: Efficiency estimates depend on the contention model

  1. Question 1 of 2 What should accompany a quoted efficiency number?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: The specified model and propagation/transmission inputs

    Different original denominator assumptions produce different estimates. The estimate is not a universal measured rate for every implementation.

  2. Question 2 of 2 Using E=1/(1+5a) and a=0.2, what is E in percent?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 50 percent

    The denominator is two, giving fifty percent.

Twisted-pair and fibre Ethernet links connect exactly two devices, and in full-duplex mode both of them can send and receive at the same time. When a computer is connected to a switch port, nothing else is on the link, so there is nothing to sense, nothing to collide with and nothing to back off from. In this full-duplex mode CSMA/CD is simply switched off. IEEE 802.3-2022 still specifies the CSMA/CD protocol for shared, half-duplex media, and repeaters for speeds up to 1000 Mb/s, alongside full-duplex operation. In practice the half-duplex mode has faded: RFC 3635, which defines Ethernet’s standard management counters, notes that interfaces of 10 Gb/s and faster do not support half duplex and that very few 1000 Mb/s interfaces do, and its collision counters never increase on an interface in full-duplex mode.

Two consequences are worth remembering. On a full-duplex link the cable length is limited by the physical layer, how far the signal stays clean, and no longer by the slot time. And the 64-byte minimum frame remains, kept for compatibility rather than for collision detection. Switching moved the sharing problem from the cable into the switch, which now decides what to do when two frames want the same output port, the subject of the next module.

GATE CS

The GATE 2027 syllabus for Computer Science names medium access control and Ethernet in its Computer Networks section. The calculations to practise are the ones in this lesson: the minimum frame size from the bit rate and the cable length, the backoff range after the n-th collision, and the efficiency from a with the formula the question gives.

Separate the original full-duplex access link from competition for one switch output.

Interactive · stage by stage A full-duplex two-ended link has no shared collision domain Separate the original full-duplex access link from competition for one switch output.
A full-duplex two-ended link has no shared collision domain, step 3 of 3. Showing Two ends, No CSMA/CD contention, Remaining contention. In focus: Remaining contention.Two endsIndependent directionsNo CSMA/CD contentionNo shared-cable collisionRemaining contentionSwitch output queues

The drawing shows the whole scene; its 3 steps are listed below.

Every step as text
  1. The original full-duplex comparison has two devices with simultaneous transmit and receive directions.
  2. Carrier sensing, collision detection and retry backoff do not arbitrate that full-duplex point-to-point link.
  3. Two input frames can still need the same switch output. That queueing problem is separate from shared-cable collisions.

Checkpoint

Check: A full-duplex two-ended link has no shared collision domain

  1. Question 1 of 2 Can frames still compete for a switch output when access links are full duplex?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Yes, output queueing remains a separate resource problem

    Full duplex removes the shared access collision domain. It does not give an output port unlimited service capacity.

  2. Question 2 of 2 Two input frames need one output port at once. How many cannot begin service first if only one is selected?

    Type a number.

    Show the answer: Question 2 of 2

    Answer: 1 frame

    One is selected and the other must follow the output's queueing policy.

Practise the original access and frame contracts

Practice that adapts to you

Practise this lesson

13 questions about 7 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.

  1. Question 1 of 13 A link has a 0.2-us bit time and a 96-bit-time gap. How many microseconds is the gap?

    Type a number.

    Show the answer: Question 1 of 13

    Answer: 19.2 us (anything from 19.199999999 to 19.200000001 counts)

    Ninety-six times 0.2 is 19.2.

  2. Question 2 of 13 A 32-bit jam uses 0.1 us per bit. How many microseconds is it?

    Type a number.

    Show the answer: Question 2 of 13

    Answer: 3.2 us (anything from 3.199999999 to 3.200000001 counts)

    Thirty-two times 0.1 is 3.2.

  3. Question 3 of 13 A budget has 800 bit times. How many byte times is that?

    Type a number.

    Show the answer: Question 3 of 13

    Answer: 100 byte times

    Eight hundred divided by eight gives one hundred.

  4. Question 4 of 13 A slot expands from 256 to 2,048 bit times. What is the factor?

    Type a number.

    Show the answer: Question 4 of 13

    Answer: 8 factor

    2,048 divided by 256 is eight.

  5. Question 5 of 13 A range has 256 integer choices starting at zero. What is its largest count?

    Type a number.

    Show the answer: Question 5 of 13

    Answer: 255 slots

    The final value is 255.

  6. Question 6 of 13 Using the same model and a=0.6, what is E in percent?

    Type a number.

    Show the answer: Question 6 of 13

    Answer: 25 percent

    The denominator is four, giving twenty-five percent.

  7. Question 7 of 13 Three frames arrive for a single-serving output. If one starts service, how many remain?

    Type a number.

    Show the answer: Question 7 of 13

    Answer: 2 frames

    Three minus one leaves two.

  8. Question 8 of 13 A 100 Mb/s CSMA/CD network spans 1,000 m of cable, and signals travel at 2 × 10⁸ m/s. Counting cable delay only, what is the minimum frame size in bits?

    Type a number.

    Show the answer: Question 8 of 13

    Answer: 1000 bits

    The frame must last one round trip: 2 × 1,000 m ÷ (2 × 10⁸ m/s) = 10 µs, and at 100 Mb/s that is 10 µs × 10⁸ bit/s = 1,000 bits. Electronics, repeaters and the jam would push the real figure higher.

  9. Question 9 of 13 After a frame's 12th collision, from how many different slot counts does an Ethernet station pick its wait?

    Choose one answer.

    Show the answer: Question 9 of 13

    Answer: 1,024, because the exponent stops growing at 10

    The wait is r slot times with 0 ≤ r < 2^k and k = min(n, 10). From the 10th collision on, k stays 10, so r is one of 1,024 values, 0 to 1,023. The frame is dropped only after 16 attempts.

  10. Question 10 of 13 What does this print?

    Read the code, then choose one answer.

    rate, distance, speed = 10_000_000, 2_500, 2e8
    print(round(2 * distance / speed * rate))
    Show the answer: Question 10 of 13

    Answer: 250

    The round trip over 2,500 m is 25 µs, and 25 µs at 10 Mb/s is 250 bit times: the frame length needed for cable delay alone. The 512-bit slot of classic Ethernet leaves room for the delays of transceivers and repeaters and for the jam.

  11. Question 11 of 13 Which of these are jobs of the slot time in classic 10 Mb/s Ethernet?

    Choose every answer that is right.

    Show the answer: Question 11 of 13

    Answer:

    • The unit in which retransmission delays are counted
    • An upper bound on how long a station needs to take hold of the cable
    • An upper bound on the length of a collision fragment

    The DIX specification names exactly these three jobs for the 512-bit slot. Frames can be much longer than one slot: a full-size frame of 1,518 bytes takes about 1.2 ms at 10 Mb/s, almost 24 slots.

  12. Question 12 of 13 Using E = 1/(1 + 5a), what is the efficiency of CSMA/CD, in percent, when the propagation time is a tenth of the frame time (a = 0.1)?

    Type a number.

    Show the answer: Question 12 of 13

    Answer: 66.7 % (anything from 66.6 to 66.8 counts)

    E = 1/(1 + 5 × 0.1) = 1/1.5 ≈ 0.667, so about two thirds of the time carries frames that get through and the rest is spent contending. With the 2e version of the model, 1/(1 + 0.544), it would be about 64.8 %.

  13. Question 13 of 13 Why does a full-duplex Ethernet link between a computer and a switch port need no CSMA/CD?

    Choose one answer.

    Show the answer: Question 13 of 13

    Answer: Only the two devices are on the link and both can send at once, so no other signal can collide with a frame

    Collisions need a shared medium. A full-duplex link carries only its two ends' traffic, in both directions at once, so carrier sense, collision detection and backoff have nothing to do; the switch sorts out competition for an output port by queuing frames instead.

Interview questions

Why must an Ethernet frame on a shared cable be at least 64 bytes long? So that a sender is still transmitting when news of a collision arrives from the farthest point of the network. In the worst case another station starts just before the first bit reaches it, and that collision takes a whole round trip to come back, so a frame must last at least the round-trip time. The 10 Mb/s rules budget less than 464 bit times for the round trip of the largest allowed network and up to 48 bits for the jam, and both fit in a slot of 512 bits, which is 64 bytes. A station that finished sending before the collision got back would think its frame had been delivered. Shorter frames are padded, and receivers discard anything shorter as a collision fragment.

Model answers open with any pass: ₹79 for 1 week ($2.99), one payment that never renews.

  1. Fresher to mid

    A factory wants one shared, half-duplex 1 Gb/s CSMA/CD segment across 300 metres of cable (signals at 2 × 10⁸ m/s), carrying mostly 64-byte sensor frames. Can that work? Work out the numbers, list your options and pick one.

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page. First step and follow-ups

  2. Fresher to mid

    A switch port connected to an old 100 Mb/s machine shows late collisions climbing on one end of the link and FCS errors and runts climbing on the other, and file copies crawl. What is the most likely cause, how do you confirm it, and how do you fix it for good?

    Model answer, Pro. First step and follow-ups

Key takeaways

  • CSMA/CD is three rules: listen and defer while the cable is busy, stop and jam when a collision is heard, then wait a random number of slot times before trying again.
  • A sender must still be sending when a collision gets back from the far end: L_min = 2τR = 2dR/v.
  • At 10 Mb/s the slot is 512 bit times (51.2 µs), so frames are at least 64 bytes; half-duplex gigabit stretched the slot to 4,096 bit times with carrier extension.
  • Backoff: after the n-th collision wait r slots, 0 ≤ r < 2^min(n, 10); give up after 16 attempts.
  • Efficiency falls as a = τ/T_frame grows: about 1/(1 + 5a), so long frames and short cables keep it high.
  • Full-duplex links have no shared medium and therefore no collisions; CSMA/CD remains in IEEE 802.3 only for half-duplex operation.

Terms in this lesson

carrier extension
Non-data symbols that extend medium occupancy for the declared half-duplex gigabit slot budget while leaving the frame's data and FCS unchanged.
collision round-trip budget
The propagation, electronics, detection and other specified delays used to determine whether a transmitting station can still detect a collision.
propagation-to-frame ratio
One-way propagation time divided by frame transmission time, used with the assumptions of a stated contention-efficiency model.
truncated backoff
A retry delay rule whose exponential choice range stops growing at a stated exponent cap, with a separate limit on attempts.

Exercise

Exercise · Easy · Python

Size the minimum frame and draw a backoff

Write two functions in csmacd.py.

min_frame_bytes(rate_bps, distance_m, speed_mps=200_000_000) returns the smallest frame, in whole bytes, that lets a sender detect a collision from the far end of distance_m metres of cable at rate_bps bits per second: the frame must last at least the round trip, 2 × distance ÷ speed. Count the cable only, round any fraction of a bit and of a byte up, and never return less than Ethernet's minimum of 64 bytes.

backoff_slots(collisions, rng) returns how many slot times a station waits after the collisions-th collision of a frame (1 for the first): a random whole number from 0 to 2^k − 1, with k = min(collisions, 10), drawn with rng.randrange(...). After the 16th collision the frame is dropped: return None without drawing a number.

  • min_frame_bytes(100_000_000, 2_800) is 350
  • min_frame_bytes(10_000_000, 2_800) is 64: 280 bits are only 35 bytes
  • backoff_slots(3, rng) asks the generator for rng.randrange(8)
  • backoff_slots(16, rng) is None

The sample tests use the real random.Random and a stand-in generator that records the range it was asked for.

Starter code · csmacd.py

import math


def min_frame_bytes(rate_bps, distance_m, speed_mps=200_000_000):
    """Return the shortest frame, in whole bytes and at least 64, that outlasts the round trip."""
    # Replace this line with your code.
    return 0


def backoff_slots(collisions, rng):
    """Return the slot times to wait after the given collision, or None after the 16th."""
    # Replace this line with your code.
    return 0
The sample tests · test_csmacd.py
import random

from csmacd import backoff_slots, min_frame_bytes


class RecordingRng:
    """A stand-in generator: remembers the range it is asked for and returns its largest value."""

    def __init__(self):
        self.asked = []

    def randrange(self, stop):
        self.asked.append(stop)
        return stop - 1


def test_frame_size_from_cable():
    """sizes the frame from the round trip on the cable"""
    assert min_frame_bytes(100_000_000, 2_800) == 350
    assert min_frame_bytes(1_000_000_000, 200) == 250


def test_frame_size_rounds_up():
    """rounds fractions of a bit and of a byte up"""
    assert min_frame_bytes(1_000_000_000, 1_000, 230_000_000) == 1087
    assert min_frame_bytes(1_000_000_000, 301) == 377


def test_frame_size_floor():
    """never goes below Ethernet's 64 bytes"""
    assert min_frame_bytes(10_000_000, 2_800) == 64
    assert min_frame_bytes(10_000_000, 0) == 64


def test_backoff_window_doubles():
    """draws from 2, 4, 8 ... choices and stops doubling at 1,024"""
    rng = RecordingRng()
    assert backoff_slots(1, rng) == 1
    assert backoff_slots(3, rng) == 7
    assert backoff_slots(10, rng) == 1023
    assert backoff_slots(15, rng) == 1023
    assert rng.asked == [2, 8, 1024, 1024]


def test_backoff_gives_up():
    """drops the frame after the 16th collision without drawing a number"""
    rng = RecordingRng()
    assert backoff_slots(16, rng) is None
    assert rng.asked == []


def test_backoff_with_a_real_generator():
    """stays inside 0 to 15 after a fourth collision and reaches both ends"""
    rng = random.Random(5)
    draws = [backoff_slots(4, rng) for _ in range(2_000)]
    assert min(draws) == 0 and max(draws) == 15
A hint

Compute the bits as 2 * distance_m * rate_bps / speed_mps, round up with math.ceil, then turn bits into bytes with another math.ceil(bits / 8) and take max(64, ...). For the backoff, return None first when collisions >= 16; otherwise call rng.randrange(2 ** min(collisions, 10)) and return its result.

The sample tests run on this device, in your browser (Pyodide): nothing is sent to mysmartcopilot.com. The first run downloads Python (about 13.5 MB), which is kept for the next runs. A check in your browser is feedback for you, not proof that the code is right for every input.

References

Related tools

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.