Hurry! Try our new Interactive Courses for FREE. 🥳   🚀

Data Link Control

In this tutorial, we will be covering one of the important concepts of the Data link layer i.e Data Link Control.

There are two main functions of the Data link layer and these are Data Link Control and Media Access control. Data link control mainly deals with the design and procedure of communication between two adjacent nodes: node-to-node communication.

Media access control is another main function of the Data Link layer which mainly specifies how the link is shared.

Let us first cover Data link control in this tutorial and then in the next tutorial we will move on to Media access control.

Functions in Data Link Control

The functions included in data link control are:

  • Framing

  • Flow and Error Control

  • Software Implemented protocols(that provides smooth and reliable transmission of frames between nodes.)

Framing

In the Physical layer, data transmission means moving bits are in the form of a signal from the source to the destination. The Physical layer also provides synchronization that mainly ensures that the sender and the receiver use the same bit durations and timings.

The bits are packed into the frames by the data link layer; so that each frame is distinguishable from another frame.

The Framing in the data link layer separates a message from one source to a destination or from other messages to other destinations just by adding a sender address and destination address; where the destination address specifies where the packet has to go and the sender address helps the recipient to acknowledge the receipt.

Frames can be either of fixed size or of variable size. By using frames the data can be easily get broken up into recoverable chunks and in order to check the corruption in transmission, these chunks can be checked easily.

Problems in Framing

Given below are some of the problems caused due to the framing:

  1. Detecting the start of the frame
    Whenever a frame is transmitted then every station must be able to detect this frame. Any Station detects the frame by looking out for a special sequence of bits that are marked at the beginning of the frame that is Starting Frame Delimiter(SFD).

  2. How any station detects a frame
    Every station in the network listens to the link for the SFD pattern through the sequential circuit. If an SFD is detected then the sequential circuit alerts the station. After that, the Station checks the destination address in order to accept or reject the frame.

  3. Detecting the end of the frame
    It is when to stop reading the frame.

Parts of a frame

Different parts of a frame are as follows:

1. Flag
A flag is used to mark the beginning and end of the frame.

2.Header
The frame header mainly contains the address of the source and the destination of the frame.

3.Trailer
The frame trailer mainly contains the error detection and error correction bits.

4.Payload Field
This field contains the message to be delivered.

Types of Framing

Framing is mainly categorized into two parts:

  • Fixed-size Framing

  • Variable-size Framing

Let us cover the above given two types one-by-one;

Fixed-size framing

In the fixed-size framing, there is no need for defining the boundaries of the frame. The size or length of the frame itself can be used as a delimiter.

One drawback of fixed size framing is that it will suffer from Internal fragmentation if the size of data is less than the size of the frame.

Variable-size framing

In Variable-size framing, the size of each frame is different. Thus there is a need of the way in order to define the end of the frame and the beginning of the next.

There are two approaches used for Variable-size framing:

Character-Oriented Protocols

In the Character-Oriented protocol, data to be carried are 8-bit characters from a coding system such as ASCII.

Now the parts of the frame in Character-Oriented Framing are as follows:

1.Frame Header

The header of the frame contains the address of the source and destination in the form of bytes.

2.Payload Field

The Payload field mainly contains the message that is to be delivered. In this case, it is a variable sequence of data bytes.

3.Frame trailer

The trailer of the frame contains the bytes for error correction and error detection.

4.Flag

In order to separate one frame from the next an 8-bit(that is 1 byte) flag is added at the beginning and end of the frame.

Let us take a look at the frame in Character-Oriented Protocol:

This technique was popular when the data was in the form of text that was exchanged by the data link layers. The flag selected could be any character that is not used for text communication. But there is a need to send other types of information like graphs, audio, and video.

Now any pattern that is used for the flag could also be a part of the Information. If this happens then the receiver encounters this pattern in the middle of the data and then thinks that it has reached the end of the frame.

In order to fix the above problem, the byte-stuffing strategy was added to the character-oriented framing.

Byte-stuffing

It is a process of adding 1 special byte whenever there is a character with the same pattern as the flag.

  • The data section is stuffed with an extra byte and this byte is usually called the Escape character(ESC) and it has a predefined bit pattern.

  • Whenever the receiver encounters an ESC character, then it removes it from the data section and then treats the next character as the data.

Byte stuffing and unstuffing

The disadvantage of using character-oriented framing is that due to this there becomes too much overhead on to the message due to which the total size of the frame gets increases. The another drawback is that the current coding system has 16-bit or 32-bit characters that surely get conflicted with the 8-bit encoding.

Bit-Oriented Protocols

In Bit-oriented framing mainly the data section of the frame is a sequence of bits that are to be interpreted by the upper layer as text, graphics, audio, video, etc.

In this, there is also a need for a delimiter in order to separate one frame from the other.

Let us take a look at the frame in Bit-oriented Protocol:

Bit-Stuffing

The process by which an extra 0 is added whenever five consecutive 1s follow a 0 in the data so that the receiver does not mistake the pattern 01111110 for a flag is commonly referred to as Bit stuffing.

The above figure shows the bit stuffing at the sender and the bit removal at the receiver. It is important to note that even if we have a 0 after five 1s, we will still stuff a 0. The removal of 0 is done by the receiver.

It simply means that whenever the flag-like pattern 01111110 appears in the data then it will change the data to 011111010(stuffed) and then it is not mistaken as a flag by the receiver.

The real flag 01111110 is not stuffed by the sender and thus is recognized by the receiver.