0% found this document useful (0 votes)
2 views12 pages

Unit 2

Uploaded by

dipukumarbth584
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views12 pages

Unit 2

Uploaded by

dipukumarbth584
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

UNIT 2: DATA LINK LAYER

1. Data Link Layer – Need, Services Provided

Introduction

The Data Link Layer is the 2nd layer of the OSI Model. It is
responsible for the reliable transfer of data between two directly
connected devices on the same network.

It receives data from the Network Layer, converts it into frames, and
sends them to the Physical Layer. At the receiver, it extracts the data
from the frame and passes it to the Network Layer.

The Data Link Layer is divided into two sublayers:

 LLC (Logical Link Control) – Provides flow control and error


control.

 MAC (Media Access Control) – Controls access to the


communication medium and provides MAC addressing.

Need for the Data Link Layer

The Data Link Layer is needed because:

 It provides reliable communication between neighboring devices.

 It converts packets into frames.

 It detects and corrects transmission errors.

 It controls the flow of data between sender and receiver.

 It manages access to the shared communication channel.

Services Provided by the Data Link Layer

1. Framing

The Data Link Layer divides data into frames before transmission.

2. Physical Addressing

Each frame contains the MAC address of the sender and receiver.

3. Flow Control
Prevents the sender from sending data faster than the receiver can
process.

4. Error Control

Detects and corrects transmission errors using checksums, CRC, and ARQ
techniques.

5. Access Control

Determines which device can use the communication channel at a


particular time.

2. Framing

Definition

Framing is the process of dividing a continuous stream of bits into


smaller units called frames.

Each frame contains:

 Header

 Data

 Trailer

Need for Framing

 Synchronization

 Error detection

 Addressing

 Reliable transmission

Framing Methods

(a) Character Count

The first field stores the total number of characters in the frame.

Advantage:
 Simple implementation.

Disadvantage:

 If the count field is corrupted, the receiver loses synchronization.

(b) Character Stuffing

Special characters indicate the beginning and end of a frame. If the same
character appears in the data, an escape character is inserted.

Advantage:

 Simple for character-oriented protocols.

Disadvantage:

 Extra characters increase overhead.

(c) Bit Stuffing

Frames start and end with a special bit pattern (usually 01111110).
Whenever five consecutive 1s appear in the data, the sender inserts a 0.
The receiver removes this extra 0.

Advantage:

 Works well for bit-oriented protocols (e.g., HDLC).

Disadvantage:

 Slight increase in transmission overhead.

(d) Physical Layer Coding Violation

Uses unused signal patterns of the Physical Layer to indicate frame


boundaries.

Advantage:

 No extra bits are added.

Disadvantage:

 Depends on the physical encoding scheme.

3. Flow Control
Definition

Flow control prevents the sender from transmitting data faster than the
receiver can handle.

Need

 Prevents receiver buffer overflow.

 Improves communication efficiency.

 Ensures reliable transmission.

Methods

(a) Stop-and-Wait

 Sender transmits one frame.

 Waits for ACK.

 Sends the next frame only after receiving ACK.

Advantages

 Simple.

 Reliable.

Disadvantages

 Low efficiency due to waiting time.

(b) Sliding Window

 Sender can send multiple frames before receiving ACKs.

 Uses a window to control the number of outstanding frames.

Advantages

 Better channel utilization.

 Higher throughput.

Disadvantages

 More complex than Stop-and-Wait.


4. Error Control

Definition

Error control detects and corrects transmission errors.

It ensures that the receiver obtains the correct data.

Types of Errors

Single-bit Error

Only one bit changes.

Example:

10110010

10110000

Multiple-bit Error

More than one bit changes.

Burst Error

Two or more consecutive bits change.

Burst errors are the most common in communication systems.

Error Detection Techniques

 Parity Check

 Checksum

 Cyclic Redundancy Check (CRC)

Error Correction

Errors are corrected using:

 Hamming Code
 ARQ (Automatic Repeat Request)

5. Data Link Layer Protocols

These protocols provide reliable communication between two directly


connected devices.

(a) Stop-and-Wait Protocol

Definition

The sender sends one frame and waits for an acknowledgment before
sending the next frame.

Working

1. Send Frame.

2. Wait for ACK.

3. If ACK received → Send next frame.

4. If timeout occurs → Retransmit the frame.

Advantages

 Easy to implement.

 Reliable.

Disadvantages

 Low throughput.

 Poor performance on long-distance links.

(b) Sliding Window Protocol

Definition

Multiple frames can be sent before receiving acknowledgments.

The sender maintains a window of frames that are allowed to be


transmitted.
Types

 1-Bit Sliding Window

 Go-Back-N

 Selective Repeat

6. 1-Bit Sliding Window Protocol

Definition

The simplest Sliding Window protocol where the window size is 1.

Sequence numbers alternate between 0 and 1.

Working

1. Send Frame 0.

2. Receive ACK 0.

3. Send Frame 1.

4. Receive ACK 1.

Advantages

 Prevents duplicate frames.

 Simple implementation.

Disadvantages

 Low efficiency.

7. Go-Back-N ARQ

Definition

The sender can transmit multiple frames without waiting for ACKs.

If one frame is lost, that frame and all subsequent frames are
retransmitted.
Working

Example:

Frames:

01234

If Frame 2 is lost:

The receiver discards Frames 3 and 4.

Sender retransmits:

234

Advantages

 Higher throughput than Stop-and-Wait.

 Efficient for low-error networks.

Disadvantages

 Wastes bandwidth when many frames are retransmitted.

8. Selective Repeat ARQ

Definition

Only the lost or damaged frame is retransmitted.

Correctly received frames are stored in the receiver's buffer.

Working

Frames:

01234

If Frame 2 is lost:

Receiver stores Frames 3 and 4.

Sender retransmits only:

2
Advantages

 Better bandwidth utilization.

 Higher efficiency.

Disadvantages

 Requires more memory.

 More complex implementation.

Difference: Go-Back-N vs Selective Repeat

Selective
Feature Go-Back-N
Repeat

Retransmissi Lost frame and all following Only lost


on frames frame

Buffer
Small Large
Required

Efficiency Lower Higher

More
Complexity Simple
Complex

9. Hybrid ARQ (HARQ)

Definition

Hybrid ARQ combines Forward Error Correction (FEC) and Automatic


Repeat Request (ARQ).

The receiver first attempts to correct errors using error-correcting codes. If


correction fails, it requests retransmission.

Advantages

 Better reliability.

 Fewer retransmissions.

 Improved performance.
Applications

 LTE

 4G

 5G

 Wi-Fi

10. Protocol Verification

Protocol verification checks whether a communication protocol behaves


correctly under all conditions.

Two common models are:

(a) Finite State Machine (FSM)

Definition

An FSM represents a protocol using:

 States

 Inputs

 Outputs

 State transitions

Components

 Initial State

 Current State

 Next State

 Transition

Advantages

 Easy to understand.

 Useful for protocol design.


Disadvantages

 Difficult to model very large protocols.

(b) Petri Net Model

Definition

A Petri Net is a graphical model used to represent concurrent and parallel


systems.

It consists of:

 Places

 Transitions

 Tokens

Advantages

 Models concurrent operations.

 Detects deadlocks.

 Suitable for complex protocols.

Disadvantages

 More complex than FSM.

11. ARP (Address Resolution Protocol)

Definition

ARP converts an IP Address into a MAC Address.

Working

1. Sender broadcasts an ARP Request.

2. Device with the matching IP replies with its MAC address.

3. Sender stores the mapping in the ARP cache.


Advantages

 Enables communication within a LAN.

 Automatically resolves MAC addresses.

12. RARP (Reverse Address Resolution Protocol)

Definition

RARP converts a MAC Address into an IP Address.

It was mainly used by diskless workstations during booting and has largely
been replaced by BOOTP and DHCP.

Working

1. Device sends a RARP Request.

2. RARP server replies with the IP address.

13. GARP (Gratuitous Address Resolution Protocol)

Definition

GARP is an ARP request sent by a device for its own IP address.

Uses

 Updates ARP tables of other devices.

 Detects duplicate IP addresses.

 Announces a change in MAC address.

You might also like