Data Link Layer (OSI Layer 2)
The Data Link Layer (DLL) is one of the most important topics in Computer Networks for GATE CSE. Questions related to framing, error detection, ARQ protocols, MAC protocols, Ethernet, and switching are frequently asked in the examination.
This guide provides concise yet comprehensive revision notes that help you revise the entire Data Link Layer in less than three hours.
What is the Data Link Layer?
The Data Link Layer is Layer 2 of the OSI (Open Systems Interconnection) Model. It provides reliable communication between two directly connected devices by converting a stream of bits into frames and ensuring error‑free transmission.
Protocol Data Unit (PDU)
| OSI Layer | PDU |
|---|---|
| Physical Layer | Bits |
| Data Link Layer | Frames |
| Network Layer | Packets |
Functions of the Data Link Layer
The major responsibilities of the Data Link Layer are:
- Framing
- Physical Addressing (MAC Address)
- Error Detection
- Error Control
- Flow Control
- Medium Access Control (MAC)
These functions ensure that data is delivered efficiently and accurately across a physical network.
Framing
Framing is the process of dividing a continuous stream of bits into manageable units called frames.
Types of Framing
Fixed‑Size Framing
- Every frame has the same size.
- Simple implementation.
- Used in technologies like ATM.
Variable‑Size Framing
Frame sizes may vary depending on the data. Common techniques include:
- Character Count
- Byte Stuffing
- Bit Stuffing
Byte Stuffing
Byte stuffing is used in character‑oriented protocols.
A special byte known as the Flag marks the beginning and end of a frame. If the same flag appears inside the data, an Escape Character (ESC) is inserted before it. The receiver removes the ESC during processing to restore the original data.
Bit Stuffing
Bit stuffing is used in bit‑oriented protocols such as HDLC.
Flag Pattern
Rule
Whenever the sender encounters five consecutive 1s, it inserts a 0 immediately afterward. The receiver removes this extra 0 during decoding.
Example
Original Data
After Bit Stuffing
Error Detection Techniques
The Data Link Layer detects transmission errors using various techniques.
1. Parity Check
- Even Parity: The total number of 1s should be even.
- Odd Parity: The total number of 1s should be odd.
Limitation: It cannot reliably detect multiple‑bit errors.
2. Checksum
The sender:
- Divides data into blocks
- Adds all blocks
- Computes the one's complement
The receiver performs the same calculation. If the final result is all 1s, the data is considered error‑free.
3. Cyclic Redundancy Check (CRC)
CRC is the most reliable error detection technique used in modern communication systems. It works using polynomial division.
- Sender: Computes CRC bits and appends them to the frame.
- Receiver: Performs polynomial division. If the remainder is zero, the frame is accepted.
Error Control
Error control ensures lost or corrupted frames are retransmitted.
Stop‑and‑Wait ARQ
The sender transmits one frame and waits for an acknowledgment (ACK). If no ACK is received before timeout, the frame is retransmitted.
- Advantages: Simple implementation
- Disadvantages: Low efficiency, poor bandwidth utilization
Go‑Back‑N ARQ
Multiple frames can be transmitted without waiting. If one frame is lost, all subsequent frames are discarded by the receiver. The sender retransmits from the lost frame onward.
Selective Repeat ARQ
The receiver accepts correctly received frames even if one frame is missing. Only the erroneous frame is retransmitted. This protocol provides the highest efficiency but is more complex to implement.
Comparison of ARQ Protocols
| Protocol | Window Size | Retransmission |
|---|---|---|
| Stop‑and‑Wait | 1 | One frame |
| Go‑Back‑N | Multiple | Lost frame and all following frames |
| Selective Repeat | Multiple | Only erroneous frame |
Flow Control
Flow control prevents a fast sender from overwhelming a slow receiver. The two primary techniques are:
- Stop‑and‑Wait
- Sliding Window Protocol
Sliding Window Protocol
Sliding Window allows multiple frames to remain unacknowledged simultaneously.
- Better bandwidth utilization
- Higher throughput
- Increased network efficiency
MAC Address
A MAC (Media Access Control) Address uniquely identifies a network interface.
- 48‑bit address (6 Bytes)
- Globally unique
- Stored in the Network Interface Card (NIC)
LLC and MAC Sublayers
The Data Link Layer is divided into two sublayers.
Logical Link Control (LLC)
- Error Control · Flow Control
Media Access Control (MAC)
- Physical Addressing · Medium Access
Multiple Access Protocols
Pure ALOHA
Efficiency: 18.4%
Slotted ALOHA
Efficiency: 36.8% – approximately twice as efficient as Pure ALOHA.
CSMA (Carrier Sense Multiple Access)
Before transmitting, a station first listens to the communication channel. Variants include:
- 1‑Persistent
- Non‑Persistent
- p‑Persistent
CSMA/CD
Carrier Sense Multiple Access with Collision Detection. Used in Traditional Ethernet.
- Listen
- Transmit
- Detect Collision
- Stop Transmission
- Wait Random Backoff
- Retransmit
CSMA/CA
Carrier Sense Multiple Access with Collision Avoidance. Used in Wi‑Fi Networks. Since wireless devices cannot detect collisions effectively, they avoid collisions using RTS · CTS · ACK.
Ethernet
Ethernet follows the IEEE standard: IEEE 802.3
- Wired LAN Technology
- Uses MAC Addressing
- Originally Based on CSMA/CD
- High‑Speed Communication
Switch
A Switch operates at OSI Layer 2. It forwards frames using MAC addresses.
- Full Duplex Communication
- High Speed
- One Collision Domain per Port
- Reduced Network Congestion
Bridge
A Bridge also works at the Data Link Layer. Its primary function is connecting multiple LAN segments while filtering traffic using MAC addresses.
Hub vs Bridge vs Switch
| Feature | Hub | Bridge | Switch |
|---|---|---|---|
| OSI Layer | 1 | 2 | 2 |
| Address Used | None | MAC | MAC |
| Collision Domain | One | Separate | One per Port |
| Performance | Low | Medium | High |
Virtual LAN (VLAN)
A VLAN logically divides a physical LAN into multiple virtual networks.
- Improved Security
- Better Network Management
- Reduced Broadcast Traffic
- Easier Administration
Broadcast Domain
- A Switch normally creates one broadcast domain.
- VLANs divide broadcast domains.
- Routers separate broadcast domains.
Important GATE Formulas
Go‑Back‑N
Selective Repeat
Frequently Asked GATE Facts
| Topic | Important Fact |
|---|---|
| Data Link Layer | Layer 2 |
| PDU | Frame |
| Address | MAC Address |
| MAC Address Length | 48 Bits |
| Ethernet | IEEE 802.3 |
| Wi‑Fi | IEEE 802.11 |
| Bit Stuffing | Insert 0 after five consecutive 1s |
| CRC | Polynomial Division |
| Pure ALOHA | 18.4% Efficiency |
| Slotted ALOHA | 36.8% Efficiency |
| CSMA/CD | Ethernet |
| CSMA/CA | Wi‑Fi |
| Switch | Layer 2 |
| Bridge | Layer 2 |
| Hub | Layer 1 |
Last‑Minute Revision
If you have only two minutes before the exam, remember these key points:
- Data Link Layer = OSI Layer 2
- PDU = Frame
- Address = 48‑bit MAC Address
- Main Functions = Framing, Error Detection, Error Control, Flow Control, MAC
- Bit Stuffing inserts a 0 after every five consecutive 1s
- CRC is the most reliable error detection technique
- Stop‑and‑Wait sends one frame at a time
- Go‑Back‑N retransmits from the lost frame onward
- Selective Repeat retransmits only the erroneous frame
- Pure ALOHA Efficiency = 18.4%
- Slotted ALOHA Efficiency = 36.8%
- Ethernet uses IEEE 802.3
- Wi‑Fi uses IEEE 802.11
- CSMA/CD is used in Ethernet
- CSMA/CA is used in Wi‑Fi
- Switch operates at Layer 2
- Router separates broadcast domains
Conclusion
The Data Link Layer forms the foundation of reliable communication in computer networks. For GATE CSE, mastering framing, error detection techniques, ARQ protocols, Ethernet, switching, MAC addressing, and multiple access protocols is essential. Regular practice of previous‑year questions along with these revision notes will strengthen your conceptual understanding and improve your exam performance.
Data Link Layer · GATE CSE 2026 · Revision ready