Skip to content
Upgraded Study Guide

Data Link Layer Control

A deeper guide to the data-link layer services that make raw physical-layer bit streams usable: framing, addressing, error detection, error correction, and flow control.

Source focusData-Link Layer Part 1
Exam skillExplain and compare error methods
Memory hookFrame, Address, Error, Flow
Best useUse beside framing and CRC slides
Services

What The Data-Link Layer Adds

The physical layer moves bits, but bits alone do not tell the receiver where a message begins or whether it was corrupted. The data-link layer adds structure and local reliability across one link.

Core duties

Four services to remember

The chapter names the data-link duties as framing, addressing, error control, and flow control. A network-layer packet is encapsulated inside a frame, and the receiver removes the frame wrapper during deframing.

  • Framing separates one unit from the next.
  • Addressing identifies local source and destination.
  • Error control detects or corrects corrupted bits.
  • Flow control prevents overwhelming the receiver.
Analogy

The envelope model

A frame is like an envelope. The letter is the packet. The envelope carries local delivery information and marks boundaries so postal workers know what belongs together.

Layer scope

Local link, not whole Internet

Data-link delivery is local: one hop or one link at a time. End-to-end delivery is handled by higher layers, especially network and transport.

Concept Meaning Exam clue
Framing Creates frame boundaries around payload Keywords: frame, flag, header, trailer
Addressing Adds layer-2 source/destination information Keywords: physical address, MAC address
Error control Detects or corrects corrupted data Keywords: parity, CRC, checksum, FEC
Flow control Coordinates sender speed with receiver capacity Keywords: buffer, overflow, slow receiver
Mini summary
  • The data-link layer organizes raw bits into frames.
  • Its work is local to one link.
  • Error control can mean detection only or actual correction.
PDF page 5The data link layer's services: error control, flow control and access control.
Framing

Character-Oriented And Bit-Oriented Framing

The slide set shows two framing styles. Both use a flag pattern to mark frame boundaries, and both need stuffing when the flag-like pattern appears inside the data.

Character-oriented

Byte stuffing

Character-oriented protocols treat the frame as a sequence of bytes. An 8-bit flag marks the beginning and end. If the same flag byte appears in the payload, the sender inserts an extra ESC byte before it. The receiver removes the ESC during unstuffing.

Bit-oriented

Bit stuffing

Bit-oriented protocols treat the frame as a stream of bits. If the data contains five consecutive 1s, the sender inserts one extra 0. This prevents the receiver from accidentally seeing the flag pattern 01111110 inside the payload.

Exam method

How to answer stuffing questions

First identify whether the protocol is character-oriented or bit-oriented. Then apply the correct insertion rule. Byte stuffing inserts ESC before flag bytes. Bit stuffing inserts 0 after five consecutive 1s.

Concept Meaning Exam clue
Character-oriented Frame length is a multiple of bytes Stuff ESC when flag byte appears
Bit-oriented Frame is interpreted bit by bit Stuff 0 after five consecutive 1s
Flag Marks start and end of frame Often shown as 01111110
Mini summary
  • Both framing styles protect frame boundaries.
  • Byte stuffing uses ESC.
  • Bit stuffing uses a 0 after five 1s.
PDF page 7A frame in a character-oriented protocol: flags mark the start and the end.
PDF page 8Byte stuffing: an escape byte goes in front of any data byte that looks like a flag.
PDF page 9A frame in a bit-oriented protocol, delimited by the 01111110 flag.
PDF page 10Bit stuffing: a 0 is inserted after five consecutive 1s so data can never imitate the flag.
Errors

Types Of Transmission Errors

The chapter distinguishes error shape before teaching detection. This matters because some methods catch single-bit errors easily but differ in burst-error performance.

Single-bit

One changed bit

A single-bit error means exactly one bit in the data unit changes from 0 to 1 or from 1 to 0. It is simple to detect with parity.

Burst

A span of damage

A burst error means two or more bits in the data unit have changed. The changed bits do not need to be consecutive. The burst length is counted from the first corrupted bit to the last corrupted bit.

Calculation

Bits affected by burst duration

If a burst lasts for a certain time, the number of affected bits depends on bandwidth. Higher bandwidth means more bits pass during the same time, so the same 2 ms burst can affect far more bits on a 1 Gbps link than on a 1 Kbps link.

Mini summary
  • Single-bit errors flip one bit.
  • Burst errors affect a region.
  • Bandwidth affects how many bits can be damaged during a time burst.
PDF page 14A single-bit error: exactly one bit flips between sender and receiver.
PDF page 16A burst error: several bits change inside one run of the data.
Detection

Parity, CRC, And Checksum

Detection methods add redundant bits so the receiver can test whether the received data still follows an expected pattern.

Parity

Simple parity check

A parity bit is added so the total number of 1s is even for even parity, or odd for odd parity. It detects all single-bit errors but misses errors when an even number of bits flips in the same protected unit.

Stronger parity

Two-dimensional parity

Data is arranged in rows and columns. Parity is added for each row and for the overall block. This catches more patterns than one parity bit and can help locate some errors.

CRC

Cyclic Redundancy Check

CRC treats the bit pattern like a polynomial. Sender and receiver share a generator polynomial. The sender appends a remainder; the receiver divides by the same generator to check whether the result is valid.

Checksum

One’s-complement sum

The message is divided into fixed-size words, commonly 16-bit or 8-bit in examples. The sender adds all words using one’s-complement arithmetic, complements the sum, and sends it as the checksum. The receiver adds all words including the checksum to test for error.

Method

Solving a checksum question, step by step

One’s-complement addition is ordinary binary addition with one extra rule: a carry out of the leftmost column is added back into the rightmost bit. That end-around carry is the step most answers drop.

Sender

  1. Divide the message into words of the checksum size: 16-bit in the slides, 8-bit in the examples below.
  2. Set the checksum word to 0.
  3. Add every word, the checksum word included, using one’s-complement addition, folding any end-around carry back in.
  4. Complement the sum. That result is the checksum.
  5. Send the checksum with the data.

Receiver

  1. Divide the received message, checksum included, into words of the same size.
  2. Add all the words with one’s-complement addition, again folding in any end-around carry.
  3. Complement the sum to get the new checksum.
  4. If the result is all 0s, accept the message; otherwise reject it.
Worked example

Examples 7, 8 and 9 from the slides

Example 7, the sender builds the checksum. The block 10101001 00111001 is sent with an 8-bit checksum.

  1. The two words are 10101001 and 00111001.
  2. Add them: 10101001 + 00111001 = 11100010. Nothing carries out of the leftmost column, so there is nothing to fold back.
  3. Complement the sum: 11100010 becomes 00011101, which is the checksum.
  4. The pattern sent is 10101001 00111001 00011101.

Example 8, the receiver checks a clean frame.

  1. Add the three sections: 10101001 + 00111001 + 00011101 = 11111111.
  2. Complement the sum: 00000000.
  3. The result is all 0s, so the message is accepted.

Example 9, the receiver catches a burst error. A burst of length 5 flips 4 bits, so 10101111 11111001 00011101 arrives instead.

  1. Add the three sections. The partial sum is 1 11000101: a carry has left the leftmost column.
  2. Fold that carry back into the rightmost bit: 11000101 + 1 = 11000110.
  3. Complement the sum: 00111001.
  4. The result is not 0, so the message is rejected. Examples 7 and 8 never exercise the end-around carry; this one does, which is why it is the one worth practising.
Concept Meaning Exam clue
Simple parity Adds one bit to force even or odd number of 1s Detects all single-bit errors
2D parity Adds row/column-style redundancy Stronger than simple parity
CRC Uses generator polynomial and binary division Excellent for burst-error detection
Checksum Uses one’s-complement addition Common exam step-by-step method
Mini summary
  • Redundancy enables checking.
  • CRC is the strongest detection concept here.
  • Checksum questions often test procedure.
PDF page 19The three detection methods: parity check, cyclic redundancy check and checksum.
PDF page 20Encoder and decoder: redundancy is added at the sender and checked at the receiver.
PDF page 29Two-dimensional parity: parity bits on both rows and columns catch more errors.
PDF page 31CRC generator and checker: divide, send the remainder, divide again to check.
PDF page 34Division in the CRC encoder, step by step.
PDF page 42Checksum: add the sections, complement the sum, and send it with the data.
PDF page 43Data unit and checksum: the sender sends T and -T together, so the receiver's sum is 0.
PDF page 44Sender steps: divide into words, zero the checksum, add with one's complement, complement the sum.
PDF page 45Receiver steps: divide including the checksum, add, complement; zero means accept.
PDF page 46Example 7: 10101001 + 00111001 gives sum 11100010, so the checksum sent is 00011101.
PDF page 47Example 8: with no error the three sections add to 11111111, which complements to 00000000.
PDF page 48Example 9: a burst error makes the sum 11000110, which complements to 00111001, so the frame is rejected.
Correction

Error Correction And Recovery

Correction goes beyond detecting a problem. It tries to recover the original data or replace damaged data with a clean copy.

Retransmission

Ask for the data again

Retransmission is simple: detect the error and request another copy. It is efficient when errors are rare and delay is acceptable, but inefficient for wireless or real-time applications with frequent loss.

FEC

Forward Error Correction

FEC sends enough redundant information for the receiver to correct a limited number of errors without waiting for retransmission. It trades extra bits for lower recovery delay.

Interleaving

Burst error correction

Interleaving spreads neighboring chunks apart before transmission. A burst then damages small pieces of several chunks instead of destroying one continuous chunk. After deinterleaving, FEC can often repair the smaller distributed errors.

Mini summary
  • Correction may use retransmission or FEC.
  • Interleaving helps with burst errors.
  • FEC is useful when waiting for resend is costly.
PDF page 53Interleaving spreads a burst error across packets so each one loses only a chunk.
Revise

Final Cheat Sheet

Use this as the last-pass memory page before a quiz or exam.

  • DLL services Framing, addressing, error control, flow control.
  • Frame Packet plus data-link header/trailer.
  • Byte stuffing Insert ESC before flag byte in data.
  • Bit stuffing Insert 0 after five consecutive 1s.
  • Single-bit error Exactly one bit changes.
  • Burst error Two or more bits change within a span.
  • Simple parity Detects all single-bit errors.
  • CRC Uses generator polynomial.
  • Checksum One’s-complement addition and complement.
  • Retransmission Detect error and resend.
  • FEC Correct without resend.
  • Interleaving Spread burst damage across chunks.
Practice

Practice Questions With Answers

These questions target the facts, comparisons, and calculations that are easiest to test.

Why is framing necessary at the data-link layer?

Answer: It separates one transmitted unit from another.

Explanation: The receiver must know where each frame begins and ends before it can interpret the payload.

What is inserted during bit stuffing?

Answer: One 0 after five consecutive 1s.

Explanation: This prevents payload bits from looking like the flag pattern.

Why can simple parity miss some burst errors?

Answer: Because if an even number of bits changes, parity may still look correct.

Explanation: Parity only checks whether the total number of 1s has the expected even/odd property.

What is shared by sender and receiver in CRC?

Answer: The generator polynomial.

Explanation: Both sides use the same divisor to create and verify the CRC remainder.

Why is FEC useful for real-time or wireless applications?

Answer: It can correct limited errors without waiting for a retransmission.

Explanation: Retransmission delay can be too expensive when errors are frequent or timing matters.

How is burst-error length counted?

Answer: From the first corrupted bit to the last corrupted bit.

Explanation: The bits inside the span do not all need to be corrupted.