Data Link Layer



Introduction

During data transmission, errors may occur due to:

  • Noise
  • Signal distortion
  • Interference
  • Hardware problems

Error control techniques are used to detect and correct these errors so that accurate data reaches the receiver.

Types of Errors

1. Single Bit Error

  • Only one bit in the data is changed
  • Example: 101101 → 101001

2. Multiple Bit Error

  • More than one bit is changed
  • Example: 110011 → 100001

3. Burst Error

  • A group of consecutive bits is affected
  • Example: 111000101 → 111111101

Error TypeDescriptionCommon Example
Single BitOne bit changedRAM error
Multiple BitSeveral bits changedNetwork noise
Burst ErrorContinuous bits affectedWireless transmission

Error Detection Techniques

Error detection only identifies errors, it does not correct them.

Vertical Redundancy Check (VRC) / Parity Check

Concept

  • One parity bit is added to data
  • Parity can be Even or Odd

Example (Even Parity)

Data Bits1s CountParity Bit
10110014 (even)0
11010115 (odd)1

Advantages

  • Simple and fast

Limitations

  • Detects only single-bit errors
  • Cannot detect burst errors

Longitudinal Redundancy Check (LRC)

Concept

  • Data is divided into blocks
  • Parity is calculated column-wise

Example: Used in magnetic tapes and barcodes

Advantages

  • Better than VRC
  • Detects some burst errors

Disadvantages

  • Still not fully reliable

Checksum

Concept

  • Data blocks are added
  • Sum is complemented and sent
  • Receiver recomputes sum

Example

Used in:

  • TCP/IP
  • Internet communication

Advantages

  • Simple
  • Detects multiple errors

Disadvantages

  • Cannot correct errors
  • Less reliable than CRC

Cyclic Redundancy Check (CRC)

Concept

  • Data treated as binary polynomial
  • Divided by a generator polynomial
  • Remainder is appended

Used In

  • Ethernet
  • Wi-Fi
  • HDLC

Advantages

  • Excellent error detection
  • Detects burst errors

Disadvantages

  • Complex calculation
  • Cannot correct errors

Error Correction Techniques

Error correction detects and corrects errors without retransmission.

Hamming Code

Concept

  • Uses redundant parity bits
  • Detects 2-bit errors
  • Corrects 1-bit error

Parity Bit Positions

Placed at positions:
2⁰, 2¹, 2², 2³ → 1, 2, 4, 8

Hamming Distance

Minimum number of bit changes required to convert one codeword into another.

Advantages

  • Automatic error correction
  • No retransmission required

Disadvantages

  • Extra bits increase data size

Comparison Table (Very Important for Exams)

TechniqueDetects ErrorCorrects ErrorUsed In
VRCYesNoSimple systems
LRCYesNoMagnetic tapes
ChecksumYesNoTCP/IP
CRCYesNoEthernet
Hamming CodeYesYesRAM, ECC memory

Error Detection vs Error Correction

BasisError DetectionError Correction
PurposeFind errorFind & fix error
RetransmissionRequiredNot required
ExampleCRCHamming Code

Real-Life Examples

  • ATM transactions → CRC
  • Internet data packets → Checksum
  • Computer RAM → Hamming Code
  • Barcodes → LRC

Important Exam Questions

  • Explain types of transmission errors
  • Describe VRC and LRC with examples
  • Explain checksum and CRC
  • Explain Hamming code with diagram
  • Differentiate error detection and correction

Conclusion

Error detection and correction techniques ensure reliable data communication.

  • CRC is best for detection
  • Hamming Code is best for correction

Flow Control and Error Control

Introduction

In data communication, two major problems can occur:

  1. Flow Control – Sender sends data faster than the receiver can handle
  2. Error Control – Data gets corrupted or lost during transmission

To solve these problems, protocols are used.

Flow Control

Flow control is a technique that ensures the sender does not overwhelm the receiver by sending data too fast.

Real-life example: A teacher speaks slowly so that students can understand and take notes.

Error Control

Error control ensures that data is delivered correctly, even if errors occur, by:

  • Detecting errors
  • Correcting errors or
  • Retransmitting data

Real-life example: If a WhatsApp message fails, it is sent again.

Stop-and-Wait Protocol

Concept

  • Sender sends one frame
  • Waits for ACK (Acknowledgement)
  • Sends next frame only after ACK

Working Steps

  • Sender sends Frame-1
  • Receiver receives it and sends ACK
  • Sender sends Frame-2

Advantages

  • Simple to implement
  • Good for small data transfer

Disadvantages

  • Very slow
  • Poor channel utilization

Real-life Example: Courier service delivers one parcel at a time and waits for confirmation.

Sliding Window Protocol

Concept

  • Sender can send multiple frames before receiving ACKs
  • Window size defines how many frames can be sent at once

Advantages

  • Better efficiency
  • Faster transmission

Disadvantages

  • More complex than Stop-and-Wait

Real-life Example: Sending multiple WhatsApp messages without waiting for delivery confirmation.

Go-Back-N ARQ Protocol

Concept

  • Sender sends multiple frames

If one frame is lost or damaged:
  • Receiver discards all subsequent frames
  • Sender retransmits from the error frame onwards

Advantages

  • Simple receiver design
  • Efficient than Stop-and-Wait

Disadvantages

  • Wastage of bandwidth due to retransmission

Real-life Example: If one exam answer sheet is lost, all following sheets are re-submitted.

Selective Repeat ARQ Protocol

Concept

  • Only lost or damaged frames are retransmitted
  • Receiver stores correctly received frames

Advantages

  • Best bandwidth utilization
  • High efficiency

Disadvantages

  • Complex implementation
  • Requires more memory

Real-life Example: Teacher asks student to rewrite only the wrong answers, not the full paper.

Comparison Table (Very Important for Exams)

ProtocolFrames SentRetransmissionEfficiency
Stop-and-WaitOne at a timeOne frameLow
Sliding WindowMultipleDependsHigh
Go-Back-N ARQMultipleFrom error frameMedium
Selective Repeat ARQMultipleOnly error framesVery High

Flow Control vs Error Control

BasisFlow ControlError Control
PurposeControl data speedEnsure correctness
FocusSender-receiver speedLost/corrupted frames
ExampleSliding WindowARQ Protocols

Important Exam Questions

  • Explain Stop-and-Wait protocol with diagram
  • Describe Sliding Window protocol
  • Explain Go-Back-N ARQ with example
  • Explain Selective Repeat ARQ with advantages
  • Differentiate Go-Back-N and Selective Repeat ARQ

Key Exam Tips

  • Always draw sequence diagrams
  • Mention ACK and retransmission logic
  • Use comparison tables in answers
  • Write real-life example for full marks

Conclusion

Flow control and error control protocols ensure efficient and reliable data transmission.

  • Stop-and-Wait → Simple but slow
  • Sliding Window → Faster
  • Go-Back-N → Moderate efficiency
  • Selective Repeat → Best performance

Channel Allocation Protocols

Introduction to Channel Allocation

Channel allocation refers to how multiple devices share a single communication channel efficiently without causing confusion or data collision.

Real-life example: Many students want to speak in a classroom → rules are needed so everyone can speak properly.

Categories of Channel Allocation Protocols

Channel allocation techniques are broadly divided into three categories:

  1. Random Access Protocols
  2. Controlled Access Protocols
  3. Channelization Protocols

Random Access Protocols

In random access, any station can transmit data at any time. If collision occurs, it is handled using retransmission rules.

ALOHA Protocol

Concept

  • Stations transmit data whenever they have data
  • If collision occurs, data is retransmitted after random time

Types

  1. Pure ALOHA – Transmit anytime
  2. Slotted ALOHA – Transmit only at fixed time slots

Advantages

  • Simple
  • Easy to implement

Disadvantages

  • High collision
  • Low efficiency

Real-life example: People speaking randomly in a group discussion.

CSMA (Carrier Sense Multiple Access)

Concept

  • Station listens to the channel before sending
  • If channel is free → transmit
  • If busy → wait

Types

  • 1-Persistent CSMA
  • Non-Persistent CSMA
  • p-Persistent CSMA

Example: Checking if someone is talking before speaking.

CSMA/CD (Collision Detection)

Concept

  • Used in wired Ethernet
  • Detects collision while transmitting
  • Stops transmission and retries

Advantages

  • Reduced collision time

Disadvantages

  • Not suitable for wireless networks

CSMA/CA (Collision Avoidance)

Concept

  • Used in wireless networks
  • Avoids collision instead of detecting it
  • Uses ACK and waiting time

Example

Wi-Fi networks (IEEE 802.11)

Controlled Access Protocols

In controlled access, stations take turns to transmit data.

Token Passing Protocol

Concept

  • A special packet called token circulates
  • Only the station holding the token can transmit

Advantages

  • No collision
  • Fair access

Disadvantages

  • Token loss can stop communication

Example: Passing a microphone in a meeting.

Channelization Protocols

Channelization divides the channel into smaller parts and assigns each part to a station.

FDMA (Frequency Division Multiple Access)

Concept

  • Channel divided into frequency bands
  • Each user gets a separate frequency

Example: FM radio stations

TDMA (Time Division Multiple Access)

Concept

  • Channel divided into time slots
  • Each user transmits in its time slot

Example: Mobile communication

CDMA (Code Division Multiple Access)

Concept

  • All users use same frequency & time
  • Unique codes separate users

Example: 3G mobile networks

Comparison Tables (Very Important for Exams)

Protocol Category Comparison

CategoryCollisionEfficiencyExample
Random AccessYesMediumALOHA
Controlled AccessNoHighToken Passing
ChannelizationNoVery HighTDMA

Random Access Protocol Comparison

ProtocolCollision HandlingUsed In
ALOHARetransmissionSatellite
CSMASense channelLAN
CSMA/CDDetect collisionEthernet
CSMA/CAAvoid collisionWi-Fi

Channelization Techniques Comparison

TechniqueDivisionUsed In
FDMAFrequencyRadio
TDMATimeGSM
CDMACode3G

Important Exam Questions

  • Explain channel allocation protocols
  • Describe ALOHA and CSMA
  • Differentiate CSMA/CD and CSMA/CA
  • Explain FDMA, TDMA, and CDMA
  • Compare random access, controlled access, and channelization

Exam Tips

  • Always draw simple diagrams
  • Use comparison tables
  • Mention real-life examples
  • Write protocol advantages & disadvantages

Conclusion

Channel allocation protocols ensure fair, efficient, and collision-free communication.

  • Random Access → Simple but collision-prone
  • Controlled Access → Organized and fair
  • Channelization → Highly efficient