Data link layer protocols are classified according to whether the transmission channel is noiseless or noisy. Noiseless is an ideal or perfect channel where no frames are lost, duplicated, or corrupted. In contrast, a noisy channel indicates that there will be a lot of disruption in the path when data is transmitted from the sender to the receiver.
Introduction
A network protocol is a set of recognized rules that govern how data is formatted, sent, and received so that computer network devices ranging from servers and routers to endpoints can communicate despite differences in their underlying infrastructures, designs, or standards. These rule sets are typically specified by headers (fixed headers determined by the protocol). These headers define the message’s content and how it is processed. To detect the error, the header must contain the destination address, the source address, and the message checksum.
Categorization of Protocol
The protocols that can be used for noiseless (error-free) channels and those that can be used for noisy (error-causing) channels are studied separately. Although the first group of protocols cannot be applied in real life, they are utilized as a foundation for noise channel protocols.
- Noiseless Channel:-
A noiseless channel is an ideal or nearly perfect channel in which no frames are lost, distorted, or duplicated. The protocol does not include error control in these types of channels. - Noisy Channel:-
A noisy channel indicates that there will be a lot of disruption in the path when data is transmitted from the sender to the receiver.
Noiseless Channel
There are two protocols in the noiseless channel, which are as follows.
Simplest Protocol
- There is no flow control or error control mechanism in the simplest protocol. The simplest protocol is a unidirectional protocol in which the data frames travel in only one direction from the sender to the receiver. The processing time of the simplest protocol is negligible. Hence it can be neglected.
- The transmission channel is completely noiseless (a channel in which no frames are lost, corrupted, or duplicated).
- The sender and the receiver are always ready to send and receive data.
- The sender sends a sequence of data frames without thinking about the receiver.
- There is no data loss hence
no ACK (Acknowledgment)
orNACK (Negative acknowledgment)
. - The protocol is divided into two steps: the sender and the receiver. The sender runs in the source machine’s data link layer, while the receiver operates in the destination machine’s data link layer. There is no usage of a sequence number or acknowledgments in this case.
Design:
The data link layer at the sender site receives data from its network layer, creates a frame, and sends it. The data link layer (receiver site) receives a frame from the physical layer, extracts data from the frame, and sends it to the network layer. The sender and receiver’s data link layers provide communication/transmission services to their network layers. For the physical movement of bits, the data link levels rely on the services offered by their physical layers.
Flow Diagram:
This Flow Diagram depicts a communication scenario utilizing the simplest protocol. It is pretty simple. Without regard for the receiver, the sender broadcasts a succession of frames. For example, the sender will send three frames, and the receivers will receive three frames. Remember that data frames are represented by slanted boxes, with the height of the box defining the transmission time difference between the first and last bit in the frame.
Stop and Wait Protocol
- Stop-and-wait is the most basic retransmission protocol.
- The
transmitter (Station A)
sends a frame over the communication line and waits for thereceiver's positive or negative acknowledgment (station B)
. - Station B sends a
positive acknowledgment (ACK)
to station A if there is no error in the transmission. - The transmitter now begins to send the next frame. If a frame is received with errors at station B, a
negative acknowledgment (NAK)
is transmitted to station A. Station ‘A’ must retransmit the original packet in a new frame in this situation. - There is also a chance that the information frames or ACKs will be lost.
- The sender is then outfitted with a timer. When the timer expires at the end of the time-out interval and no recognizable acknowledgment is received, the same frame is transmitted again.
- Stop and wait refers to a sender who delivers one frame and then waits for an acknowledgment before proceeding.
Design:
We can see traffic on the front/forward channel (from sender to receiver) and the back/reverse channel when we compare the stop-and-wait protocol design model to the Simplest protocol design model. There is always one data frame on the forward channel and one acknowledgment frame on the reverse channel. We now demand a half-duplex connection.
Flow diagram:
This diagram depicts a communication utilizing the Stop-and-Wait protocol. It remains straightforward. The sender delivers a frame and then waits for the recipient to respond. When the receiver’s ACK (acknowledged) arrives, send the next frame, and so on. Remember that when two frames are present, the sender will be involved in four events, and the receivers will be involved in two events.
Noisy Channel
There are three major protocols in the noisy channel, which are as follows.
Stop and Wait Automatic Repeat Request
- They were used in connection-oriented communication.
- Stop and Wait provides error and flow control.
- It is employed in the Data Link and Transport Layers.
- Stop and wait ARQ primarily employs the Sliding Window Protocol idea, with Window Size 1 as its primary implementation.
Working
- If a frame is destroyed during transmission on a noisy channel, the receiver will detect it using the checksum.
- If a damaged frame is received, it is discarded, and the transmitter will retransmit the same frame whenever a proper acknowledgment is received.
- If the acknowledgment frame is missing, the data link layer on
'A'
will eventually time out. Because it has not received an ACK, it concludes that its data frame has been lost or corrupted and resends the frame containingpacket 1
. This duplicate frame also arrives at the data link layer on'B'
, resulting in a duplicated portion of the file and a protocol failure. - To resolve this issue, insert a sequence number into the message’s header.
- Since just the message is ever transmitted, the receiver looks up the sequence number to see if the message is a duplicate.
- The relationship between the sent message and it’s
ACK/NAK
can be maintained between the transmitting and receiving stations using just a1-bit
alternating sequence of'0' or '1'
. - Positive acknowledgments take the form of ACK 0 and ACK 1, and the frames are alternately labeled with
"0" or "1"
in a modulo-2 numbering scheme. - The following Stop & Wait ARQ with Lost frame.
Go-Back-N Automatic Repeat Request
- The sender’s window size is N in
Go-Back-N ARQ
. Assume we sayGo-Back-3
, which signifies that three frames can be delivered at once before waiting for the receiver to acknowledge. - It employs the
protocol pipelining principle
, which allows numerous frames to be delivered before getting acknowledgment of the first frame. If we have five frames and the notion is Go-Back-3, this means that three frames, namely frame 1, frame 2, and frame 3, can be delivered before anticipating acknowledgment of frame 1. - If a frame’s acknowledgment is not received within an agreed-upon time period, all frames in the current window will be retransmitted. If we sent frame number
5
but did not receive an acknowledgment, and the current window contains three frames, these three frames will be retransmitted.
Important points related to Go-Back-N ARQ:
- N specifies the window size of the sender in
Go-Back-N
, while the size of the receiver’s window is always1
. - It ignores the corrupted frames and discards them.
- It rejects out-of-order frames.
- If the acknowledgment is not received by the sender, all of the current window frames are retransmitted.
Working of Go-Back-N ARQ
Assume there is a transmitter and a receiver and seven frames to be sent. These frames’ sequence numbers are represented by the number 0,1,2,3,4,5,6
. The sender’s window size mostly determines the sequence number. However, for clarity, we used the running sequence numbers (0,1,2,3,4,5,6)
. Consider the window size to be four, which indicates that four frames can be sent at once before expecting the first frame to be acknowledged.
- To begin, the sender will send the first four frames to the receiver, i.e.,
0, 1, 2, 3
, and now the sender expects to receive the acknowledgment of the0th
frame. - Assume the receiver sent the acknowledgment for the 0 frame, and the recipient received it successfully.
- After that, the sender sends the next frame, 4, and the window will slide with four frames
(1,2,3,4)
. - The receiver will then send the acknowledgment for frame no. 1. After getting the acknowledgment, the sender will send the next frame, frame number 5, and the window will move with four frames
(2,3,4,5)
. - Assume that the receiver is not received the acknowledgment of frame no. 2; either the frame or the acknowledgment is lost.
- Instead of sending frame number 6, the sender Go-Back to 2, which is the initial frame of the current window, retransmits all frames in the current window, namely
2,3,4,5
. - This process is repeated until all the frames are successfully transmitted to their destination.
Selective Repeat ARQ
- Before learning about the working of the selective repeat ARQ, we should be familiar with the window size of the sender and receiver, as the selective repeat ARQ is a sliding window protocol only.
- In the selective repeat ARQ, both the sender and the receiver have windows of the same size. The window on the sender’s side covers the sequence of data packets that are sent (or to be sent). On the other hand, the window on the receiver’s side covers the sequence of received data packets (or to be accepted).
- The size of the sender’s window is
2^(m-1)
, where m is the number of bits used in the packet’s header to express the packet’s sequence number. The receiver’s window size is the same as that of the sender, i.e.,2^(m-1)
. The sender’s window size is represented using Ws, and the receiver’s window size is represented using Wr. - The overall working of the selective repeat ARQ is simple. Initially, the sender sends several frames according to the window size. The receiver on the other end receives the frames and sends the ACK for correct frames and
NACK
for lost or damaged frames. The sender retransmits the frames for which the receiver sent the NACK. After receiving all the frames, the receiver sorts the frame according to the sequence number for further usage.
Working
Now, let us take an example to visualize the working of selective repeat ARQ or how the data packet is transmitted using the selective repeat ARQ protocol. The image below shows the transmission of frames. Let us suppose that the window size of the sender and the receiver is 2
.
The steps of data transmission can be:
- The sender sends frames 0 and 1.
- The receiver receives the frames and sends back
ACK 0
andACK 1
. - Again the sender sends frames 2 and 3.
- The receiver only receives frame 3. So it sends back
NACK 2
, meaning that the 2nd frame is lost and needs to be retransmitted. - So, the sender sends back frame 2 and this process is continued till the receiver has received all the frames.
Conclusion
- A network protocol is a set of recognized rules that govern how data is formatted, sent, and received so that computer network devices ranging from servers and routers to endpoints can communicate despite differences in their underlying infrastructures, designs, or standards.
- The protocols that can be used for noiseless (error-free) channels and those that can be used for noisy (error-causing) channels are studied separately.
- Noiseless Channel
- Noisy Channel
- A noiseless Channel is an ideal or nearly perfect channel in which no frames are lost, distorted, or duplicated. The protocol does not include error control in these types of channels.
- A noisy channel indicates that there will be a lot of disruption in the path when data is transmitted from the sender to the receiver.
- There are two protocols in the noiseless channel, which are as follows.
- Simplest Protocol
- Stop and wait
- There are three protocols in the noisy channel, which are as follows.
- Stop and wait ARQ
- Go-Back-N-ARQ
- Selective Repeat ARQ