In this tutorial, you will learn what is framing in data link layer and the types of framing in computer networks with the help of suitable examples and diagrams.
Let’s Get Started, Happy Learning!
What is Framing in Data link layer?
Framing in data link layer is a point-to-point connection between the sender and receiver. The framing is the primary function of the data link layer and it provides a way to transmit data between the connected devices.
Framing uses frames to send or receive data. The data link layer receives packets from the network layer and converts them into frames.
If the frame size is too large, then the packet can be divided into smaller frames. Small frames are more efficient for flow control and error control.
The data link layer needs to pack bits into frames so that each frame is distinguishable from another. The simple act of inserting a letter into an envelope separates one piece of information from another.
Parts of a Frame
The frame is consist of four parts as follows.
Each frame in data link layers comprises four parts header, payload field, trailers and flag.
Header–The source and destination address is placed into the header part of the frame.
Payload field–It contains the actual message or information that the sender wants to transmit to the destination machine.
Trailer–The trailer comprises error detection and error correction bits.
Flag–It shows the beginning and end of a particular frame.
Types of Framing in Computer Networks
There are two types of framing that are used by the data link layer in computer networks. The frame can be of fixed or variable size. Based on the size, the following are the types of framing in computer networks,
- Fixed Size Framing
- Variable Size Framing
Fixed Size Framing
The frame has a fixed size. In fixed-size framing, there is no need for defining the boundaries of the frames to mark the beginning and end of a frame.
For example- This type of framing is used in ATMs, Wide area networks. They use frames of fixed size called cells.
Variable Size Framing
The size of the frame is variable in this type of framing. In variable size framing, we need a way to define the end of the frame and the beginning of the next frame. This is used in local area networks.
There are two methods to define the frame boundaries, such as length field and end decimeter.
Length field–To determine the length of the field, a length field is used. It is used in Ethernet (1EEE 802.3)
End Delimeter–To identify the size of the frame, a pattern is used as a delimiter. This method is used in the token ring. In short, it is called an ED. Two methods are used to avoid this situation if the pattern occurs in the message.
- Character Oriented Approach ( Byte Stuffing)
- Bit Oriented Approach (Bit Stuffing)
What is Byte Stuffing?
Byte stuffing is the process of adding an extra byte when there is a flag or escape character in the text. Take an example of byte stuffing as shown in the below diagram.
The sender sends the frame by adding 3 extra ESC bits and the destination machine received the frame and it removes the extra bits to covert the frame into the same message.
What is Bit Stuffing?
Most protocols use a special 8-bit pattern flag 01111110 as the delimiter to define the beginning and the end of the frame. Bit stuffing is done at the sender end and bit removal at the receiver end.
If we have a 0 after five 1s. We still stuff a 0. The receiver will remove the 0. Bit stuffing is also called bit-oriented framing.
Have you enjoyed this tutorial on what is framing in data link layer? Post your thoughts and suggestions in the comment section below. Also, try the following notes.