Open In App

Framing in Data Link Layer

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Frames are the units of digital transmission, particularly in computer networks and telecommunications. Frames are comparable to the packets of energy called photons in the case of light energy. Frame is continuously used in Time Division Multiplexing process. 

Framing is a point-to-point connection between two computers or devices consisting of a wire in which data is transmitted as a stream of bits. However, these bits must be framed into discernible blocks of information. Framing is a function of the data link layer. It provides a way for a sender to transmit a set of bits that are meaningful to the receiver. Ethernet, token ring, frame relay, and other data link layer technologies have their own frame structures. Frames have headers that contain information such as error-checking codes. 

1

At the data link layer, it extracts the message from the sender and provides it to the receiver by providing the sender’s and receiver’s addresses. The advantage of using frames is that data is broken up into recoverable chunks that can easily be checked for corruption. 

The process of dividing the data into frames and reassembling it is transparent to the user and is handled by the data link layer.

Framing is an important aspect of data link layer protocol design because it allows the transmission of data to be organized and controlled, ensuring that the data is delivered accurately and efficiently.

Problems in Framing

  • Detecting start of the frame: When a frame is transmitted, every station must be able to detect it. Station detects frames by looking out for a special sequence of bits that marks the beginning of the frame i.e. SFD (Starting Frame Delimiter).
  • How does the station detect a frame: Every station listens to link for SFD pattern through a sequential circuit. If SFD is detected, sequential circuit alerts station. Station checks destination address to accept or reject frame.
  • Detecting end of frame: When to stop reading the frame.
  • Handling errors: Framing errors may occur due to noise or other transmission errors, which can cause a station to misinterpret the frame. Therefore, error detection and correction mechanisms, such as cyclic redundancy check (CRC), are used to ensure the integrity of the frame.
  • Framing overhead: Every frame has a header and a trailer that contains control information such as source and destination address, error detection code, and other protocol-related information. This overhead reduces the available bandwidth for data transmission, especially for small-sized frames.
  • Framing incompatibility: Different networking devices and protocols may use different framing methods, which can lead to framing incompatibility issues. For example, if a device using one framing method sends data to a device using a different framing method, the receiving device may not be able to correctly interpret the frame.
  • Framing synchronization: Stations must be synchronized with each other to avoid collisions and ensure reliable communication. Synchronization requires that all stations agree on the frame boundaries and timing, which can be challenging in complex networks with many devices and varying traffic loads.
  • Framing efficiency: Framing should be designed to minimize the amount of data overhead while maximizing the available bandwidth for data transmission. Inefficient framing methods can lead to lower network performance and higher latency.

Types of framing

There are two types of framing: 

1. Fixed-size: The frame is of fixed size and there is no need to provide boundaries to the frame, the length of the frame itself acts as a delimiter.  

  • Drawback: It suffers from internal fragmentation if the data size is less than the frame size
  • Solution: Padding

2. Variable size: In this, there is a need to define the end of the frame as well as the beginning of the next frame to distinguish. This can be done in two ways: 

  1. Length field – We can introduce a length field in the frame to indicate the length of the frame. Used in Ethernet(802.3). The problem with this is that sometimes the length field might get corrupted.
  2. End Delimiter (ED) – We can introduce an ED(pattern) to indicate the end of the frame. Used in Token Ring. The problem with this is that ED can occur in the data. This can be solved by: 

    1. Character/Byte Stuffing: Used when frames consist of characters. If data contains ED then, a byte is stuffed into data to differentiate it from ED. 

    Let ED = “$” –> if data contains ‘$’ anywhere, it can be escaped using ‘\O’ character. 
    –> if data contains ‘\O$’ then, use ‘\O\O\O$'($ is escaped using \O and \O is escaped using \O).

2

Disadvantage – It is very costly and obsolete method. 

2. Bit Stuffing: Let ED = 01111 and if data = 01111 
–> Sender stuffs a bit to break the pattern i.e. here appends a 0 in data = 011101. 
–> Receiver receives the frame. 
–> If data contains 011101, receiver removes the 0 and reads the data. 

3

Examples: 

  • If Data –> 011100011110 and ED –> 0111 then, find data after bit stuffing. 
--> 01101000110110
  • If Data –> 110001001 and ED –> 1000 then, find data after bit stuffing? 
--> 1100101001

framing in the Data Link Layer also presents some challenges, which include:

Variable frame length: The length of frames can vary depending on the data being transmitted, which can lead to inefficiencies in transmission. To address this issue, protocols such as HDLC and PPP use a flag sequence to mark the start and end of each frame.

Bit stuffing: Bit stuffing is a technique used to prevent data from being interpreted as control characters by inserting extra bits into the data stream. However, bit stuffing can lead to issues with synchronization and increase the overhead of the transmission.

Synchronization: Synchronization is critical for ensuring that data frames are transmitted and received correctly. However, synchronization can be challenging, particularly in high-speed networks where frames are transmitted rapidly.

Error detection: Data Link Layer protocols use various techniques to detect errors in the transmitted data, such as checksums and CRCs. However, these techniques are not foolproof and can miss some types of errors.

Efficiency: Efficient use of available bandwidth is critical for ensuring that data is transmitted quickly and reliably. However, the overhead associated with framing and error detection can reduce the overall efficiency of the transmission.


Last Updated : 18 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads