Data Link Layer and MAC Sublayer Explained: ALOHA and CSMA/CD Worked Examples

Build a precise layer map, follow an Ethernet frame across a router, and solve Pure ALOHA, Slotted ALOHA, and CSMA/CD numericals step by step.

KnowledgeGate Team

Exam prep & CS education

Updated 13 Nov 20266 min read
Data Link Layer and MAC Sublayer Explained: ALOHA and CSMA/CD Worked Examples

In Computer Networks, “MAC” can mean a hardware address or the Medium Access Control sublayer. “DLL” means the Data Link Layer here, not a software library. Mixing these meanings makes even simple questions look harder than they are.

Use the hop-by-hop frame trace to separate packet scope from frame scope. Then apply the same layer map to one Pure-versus-Slotted ALOHA calculation and one CSMA/CD collision-window calculation.

Use CSMA/CD and ALOHA for GATE: Efficiency and Minimum Frame Size Numericals Solved for formula drills and the CSMA/CD efficiency approximation. Continue with the layer map below when the missing piece is how frames, router hops, MAC addresses, and the three access families fit around those numericals.

The Data Link Layer encloses a Network Layer packet in a frame for one physical hop. The Network Layer routes source to destination, while the Transport Layer delivers between processes.

Its responsibilities include framing, link-layer addressing, medium access, and error detection. Some protocols also provide flow control or retransmission. An Ethernet FCS can detect corruption, but does not repair bits or guarantee retransmission.

Layer

Data unit

Address or identifier

Scope

Network Layer

Packet

IP address

End to end

Data Link Layer

Frame

Link-layer address

One link

Physical Layer

Bits

None

Signal on the medium

Practise the Network Layer with Subnetting MCQs: 12 Solved IP Addressing Questions, then compare the Transport Layer through TCP and UDP MCQs: 12 Solved Transport Layer Questions.

IEEE 802 LANs divide DLL into Logical Link Control (LLC) above and Medium Access Control (MAC) below. LLC presents a common service upward. MAC defines framing, addressing, and shared-medium access. Not every non-IEEE data-link protocol uses this split.

Host A has IP 10.0.1.10 and MAC 02:AA:AA:AA:AA:10. Server B has IP 10.0.2.20 and MAC 02:BB:BB:BB:BB:20. On link 1, the Ethernet source is A's MAC. Its destination is 02:11:11:11:11:01, R1's incoming-interface MAC.

On link 2, R1 builds a new frame. Its source is 02:22:22:22:22:02, R1's outgoing-interface MAC, and its destination is B's MAC. Without NAT, IPs 10.0.1.10 and 10.0.2.20 remain unchanged. R1 replaces the frame header and FCS.

Host A to Router R1 to Server B: the IP packet 10.0.1.10 to 10.0.2.20 is unchanged while R1 rebuilds each link's Ethernet header and FCS.

3. MAC protocols: three ways to share a medium

Family

Examples

Core rule

Coordination required

Are collisions possible?

Channel partitioning

TDMA, FDMA

Divide time or frequency among users

A schedule or fixed allocation

No, when allocations do not overlap

Random access

Pure ALOHA, Slotted ALOHA, CSMA, CSMA/CD, CSMA/CA

Stations contend when they have data

None for Pure ALOHA; slot timing for Slotted ALOHA; sensing and protocol rules for CSMA variants

Yes; detection or avoidance manages the risk

Controlled access

Polling, token passing

Only the selected station transmits

A controller or token protocol

Normally avoided when coordination works

Carrier sensing reduces but cannot eliminate collisions. Distant stations can both sense idle before either new signal reaches the other, then transmit.

CSMA/CD detects collisions in classic shared, half-duplex Ethernet. CSMA/CA tries to avoid them in wireless, where listening while transmitting is impractical. Switched full-duplex Ethernet has no shared collision domain, but the timing model remains important in exams.

4. ALOHA throughput worked example: Pure versus Slotted

Let T be one frame-transmission time and G the average attempts per frame time, including retransmissions. In Pure ALOHA, starts within one T before or after the target start can overlap it. The vulnerable period is 2T, giving S = G e^(-2G).

Slotted ALOHA restricts starts to slot boundaries. Its vulnerable period is T, giving S = G e^(-G).

For T = 10 ms = 0.01 s and G = 0.5:

Calculation step

Pure ALOHA

Slotted ALOHA

Formula

S = G e^(-2G)

S = G e^(-G)

Substitute G = 0.5

S = 0.5e^(-1)

S = 0.5e^(-0.5)

Result

S = 0.1839, then 0.1839 / 0.01 = 18.39 frames/s

S = 0.3033, then 0.3033 / 0.01 = 30.33 frames/s

Unrounded values give 30.3265 - 18.3940 = 11.9325, about 11.93 more frames per second. Slotting requires time synchronisation.

These are same-load results. Pure ALOHA peaks at G = 0.5, with Smax = 1/(2e) = 0.1839. Slotted ALOHA peaks at G = 1, with Smax = 1/e = 0.3679.

5. CSMA/CD minimum frame size worked example

A sender must still be transmitting when the worst-case collision indication returns. For one-way delay tau, bit rate R, and frame length L, CSMA/CD requires L/R >= 2tau, so Lmin = 2tauR bits.

For a 10 Mb/s shared Ethernet with tau = 25.6 microseconds:

  1. Round-trip propagation delay = 2 x 25.6 = 51.2 microseconds.

  2. Lmin = 10,000,000 x 51.2 x 10^(-6) = 512 bits.

  3. 512 / 8 = 64 bytes.

  4. Check: 512 / 10,000,000 = 51.2 x 10^(-6) s = 51.2 microseconds, exactly the round-trip delay.

A 32-byte frame has 256 bits. Its transmission time is 256 / 10,000,000 = 25.6 microseconds, too short to guarantee detection of the farthest collision.

Space-time diagram: A starts at t = 0, collides near B at 25.6 microseconds; the 512-bit frame lasts the full 51.2 microsecond round trip.

Question clue

Method

Vulnerable period or throughput

Identify Pure or Slotted ALOHA, then use the matching S formula

Listen before transmitting

Apply CSMA and account for propagation delay

Minimum frame size or round-trip delay

Start with Lmin = 2tauR for CSMA/CD

Interframe spacing, backoff, and wireless acknowledgements

Think CSMA/CA

Which address changes at a router?

Link-layer addresses change for the next hop; IP endpoints stay unchanged without NAT

First identify one-way or round-trip delay, then convert units before multiplying. Keep ALOHA throughput normalised until the final frames-per-second conversion, and finish with a dimensional check. Treat these as recurring problem shapes and practise the method rather than memorising one set of numbers.

7. MAC and DLL traps that cost correct answers

Misconception

Consequence

Correction

A MAC address is the whole MAC sublayer

Addressing gets confused with medium access and framing

Treat the address as one field used by the sublayer

Carrier sensing prevents every collision

Propagation delay is ignored

Two stations can sense idle before either signal arrives

Pure ALOHA uses T and Slotted uses 2T

The throughput exponent is reversed

Pure uses 2T; Slotted uses T

A given one-way delay can be used directly

Minimum frame size is halved

Use the round trip, 2tau

A bit result is reported as bytes

The answer becomes eight times too large

Divide bits by eight

CSMA/CD logic is applied to wireless

Detection and avoidance are mixed

Wireless questions usually require CSMA/CA reasoning

Quick self-check 1: At 20 Mb/s and tau = 10 microseconds, Lmin = 2 x 10 x 10^(-6) x 20 x 10^6 = 400 bits = 50 bytes. Its 20-microsecond transmission time matches the round trip.

Quick self-check 2: Without NAT, a router changes the next link's Ethernet addresses, but not the packet's IP endpoints.

  • A frame carries a packet hop to hop.

  • MAC names both a sublayer and an address type.

  • Shared-access methods differ in coordination and collision handling.

  • ALOHA numericals begin with the vulnerable period.

  • CSMA/CD frame-size numericals begin with the round-trip delay.

For structured Computer Networks study, including medium access control, use GATE Guidance by Sanchit Sir. The GATE CS Exam category covers the wider syllabus. Keep layer scopes separate, write the formula first, and check the units.