Data link layer design issues highlight the problems that network designers must address while designing the data link layer of any networking model. But before understanding these design issues, let us first understand the need for the data link layer.
What is Data Link Layer?
The data link layer is a layer in the networking model that transforms the raw transmission facility (Hub, Repeater, Cables, Modem, and Connectors) provided by the physical layer into a reliable transmission link that is responsible for node-to-node or hop-to-hop communication.
The data link layer accepts the stream of bits from the network layer and divides them into manageable data units that we refer to as frames. Now to each frame, the data link layer adds a header that specifies the addresses of the sender and receiver of the frame.
Apart from framing and addressing, the data link layer design issues involve:
- Flow Control – The data rate at which the sender sends the data and the rate at which the receiver receives the data is different. So, the data link layer has to manage the flow control mechanism.
- Error Control – The data link layer also enhances the reliability of the physical layer. But how? It adds a mechanism to detect and retransmit the damaged or lost frames.
- Media Access Control – If multiple devices are added to the same network link, then the data link layer helps the frame to identify which device has control over the link at any given time.
Thus, we can say that using the services of the physical layer data link layer can send and receive the data bits over the communication channel. It provides a well-defined interface to the network layer, deals with errors while transmission, and regulates the flow of data to synchronize the communication between sender and receiver.
Data Link Layer Design Issues
Service Provided to Network Layer
The data link layer provides services to the network layer. One of the main services is to transfer data from the source machine’s network layer to the destination machine’s network layer.
The network layer at the source machine transfers some data bits (packets) to the data link layer. Now the data link layer transmits these bits to the data link layer at the destination machine. The destination machine’s data link layer hands over the bits to the network layer at the destination machine.
Here it seems as if two data link layers of the source and destination machine are communicating. But this is not the case in reality. Instead, the data bits travel through the source machine’s physical layer to the destination machine’s physical layer.
Then the physical layer of the destination machine passes these data bits to the data link layer there so that they can be handed over to the network layer.
The design issues of the data link layer vary from protocol to protocol for the following reasons:
- Unacknowledged connectionless service.
- Acknowledged connectionless service
- Acknowledge connection-oriented service
Unacknowledged Connectionless Service
In this scenario, the source machine delivers data frames to the destination machine without expecting acknowledgement from them. The most common example of unacknowledged connectionless service is Ethernet.
In Ethernet, the sender and receiver do not establish any logical connection between them. Neither receiver provides any acknowledgement for the received frames. In case any frame is lost, the sender does not make any effort to detect or recover the lost frame.
Acknowledged Connectionless Service
As the name suggests, the sender and receiver do not establish any logical connection between them. But the receiver provides acknowledgement for the received frames. The most popular example of this kind of service is WiFi. If a frame is lost and the sender does not receive acknowledgement for the same within a specified time interval – the sender sends the frame again.
Acknowledged Connection-Oriented Service
With this kind of service, the sender and receiver initially establish a logical connection between them. Then each outgoing frame is sequentially numbered, guaranteeing that each frame will be delivered only once and in the right order. Once all the frames get delivered, the sender and receiver release the connection between them. The most popular example of this kind of service is long distance telephone circuits.
Framing
Framing is one of the design issues of the data link layer. We have discussed earlier that the data link layer breaks the stream of bits from the network layer into discrete frames. But do you know why it does so?
Need of Framing
We know that the data link layer uses the services of the physical layer. The physical layer simply accepts the raw bits stream and delivers it to the destination. Now it may be the case that the physical layer, i.e. wired or wireless links used, may be noisy, which ultimately increases the bit error rate.
To reduce the bit error rate, the physical layer adds redundancy to the signals. But that doesn’t guarantee the bit of stream received at the destination data link layer is error-free. So, it becomes the responsibility of the data link layer to detect and correct the errors.
To detect and rectify the errors in the bit stream data link layer uses the concept of framing. While framing, the data link layer breaks the bit stream into discrete frames, and for each frame, it calculates the checksum.
The data link layer includes this checksum into the frame while transmitting it to the destination. When the frame arrives at the destination, the receiver recalculates this checksum, and if it comes out to be different, it indicates errors in the arrived frame.
Now, these frames can be of two types fixed size and variable size frame.
Types of frame
1. Fixed Length Frame
In fixed-size frames, we do not have to define any boundaries in the frame, as its size itself acts as a delimiter.
2. Variable Length Frame
With a variable-length frame, we have to define the frame boundaries, i.e. end of a frame and the beginning of the next frame. For defining boundaries of variable length frame, we have two methods as discussed below:
2.1 Character-Oriented Approach
The character-oriented approach was popular when the data link layer use to exchange the text information. In this approach, the data exchanged used to be of 8 bits and the information that the header and trailer contain should be multiple of 8.
To mark the beginning and end of the frame, the sender’s data link layer adds an 8-bit flag to the start and end of the frame. This flag could be any charter which is not part of text communication.
Nowadays, it is not limited to the exchange of text. We are exchanging graphs, audio and video. The character used for the flag could be a part of the information exchanged. So, we came up with a new strategy, byte stuffing.
2.2 Byte Stuffing
We also refer to byte stuffing as character stuffing. Here if a character in the data section has the same pattern as that of the flag, then the data link layer stuffs that part of the data section with an extra byte. We refer to this extra byte as an escape character. The escape character has a predefined bit pattern.
Now when this escape character is encountered at the receiver end, it will simply remove this character and treat the next character as data only. Till it encounters the final delimiter, i.e. flag.
But this approach also had a problem, i.e. what if the data section has character with the escape pattern? So, to eliminate this problem, the character with the escape pattern is marked with another escape character.
However, the character-oriented approach is losing its grip over framing concepts, as nowadays, the universal coding system has 16-bit or 32-bit characters. That’s why we have to move towards the bit-oriented approach.
2.3 Bit-Oriented Approach
In the character-oriented approach, we stuff an entire byte (8-bit flag an escape character) to identify the start and end of the frame. But in the bit-oriented approach, we stuff a single bit. In the bit-oriented approach to prevent a part of a data section from appearing like a flag, we stuff a single bit 0 after 5 consecutive 1s.
Here, if the data link layer identifies 0 and five consecutive 1’s, then an extra bit 0 is added to it. When the receiver receives the frame, it removes the extra bit.
Error Control
After marking the start and end of the frame, the design issues that we have to address are how to ensure that all the frames have arrived at the destination in the proper order and only once.
A more general way to ensure this is to feedback to the sender about the other end of the communication line. The receiver can provide feedback to the sender that may contain positive or negative feedback.
Positive feedback indicates that the frame reached the destination safely, the negative feedback indicates that something wrong happened with the frame and the frame should be transmitted again.
What if the frame gets loss due to some hardware issue, such as a noise burst?
In such a case, even the receiver will not provide positive or negative feedback as it has not received any frame. It may also happen that the frame has been received properly, but the acknowledgement gets the loss.
In such a scenario, the sender will keep on waiting for the acknowledgement, either positive or negative infinity. We introduce a timer into the data link layer to resolve this issue.
Now whenever the sender sends a frame, it starts a timer. This timer is set to expire after a long interval such that the time is enough for the frame to reach the destination, get it processed there, and let the acknowledgement propagate back to the sender.
In normal cases, the sender will send a frame and start the timer. The frame will reach the destination, and the acknowledgement for the same will propagate back to the sender before the timer expires.
But what if the frame or acknowledgement is lost? In such cases, after the timer expires, it alerts the sender about the potential loss. The sender will simply resend the frame. But the issue doesn’t get resolved here. What if the receiver receives the same frame more than one time? To settle this issue, we can assign a sequence number to the outgoing frames to distinguish between retransmitted and original frames.
Thus, involving the timer and sequence number ensure that each frame reaches the network layer of the destination machine exactly once. The next design issue of the data link layer is flow control.
Flow Control
It may happen that a sender sends the frame at a faster rate compared to the rate at which the receiver can receive the frames. Well, this may be the case where the sender is running on a much faster machine than the receiver. So how to resolve such a design issue?
In such a situation, even if the transmission is error-free, it may happen that the receiver is unable to handle the frames at a faster rate and may lose some of them in the process.
To prevent such a situation, we have two approaches:
1. Feedback-based Flow Control
The receiver permits the sender to send more data or at least inform the sender about how the receiver is doing.
2. Rate-based Flow Control
This approach limits the rate at which the sender can send the data so that it does not overload the receivers with the frames.
So, these are the data link layer design issues that network designers address while designing the data link layer. The data link layer is responsible for providing services to the network layer, framing, error control, and flow control.
Deep says
great explanation. Way better than any YouTube video