CS331 / Slide Breakdowns
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.
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.
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.
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.

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.
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.
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.