0% found this document useful (0 votes)
5 views

Cnd unit 4

The Data Link Layer is responsible for framing, physical addressing, error control, flow control, and access control in data transmission. It identifies and corrects errors, which can occur as single bit errors, multiple bit errors, or burst errors, using techniques like error detection and correction codes such as Hamming Code and Cyclic Redundancy Check (CRC). The document also explains the process of generating Hamming codes and the methodology for error detection and correction in data communication systems.

Uploaded by

pranjalhiray7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Cnd unit 4

The Data Link Layer is responsible for framing, physical addressing, error control, flow control, and access control in data transmission. It identifies and corrects errors, which can occur as single bit errors, multiple bit errors, or burst errors, using techniques like error detection and correction codes such as Hamming Code and Cyclic Redundancy Check (CRC). The document also explains the process of generating Hamming codes and the methodology for error detection and correction in data communication systems.

Uploaded by

pranjalhiray7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

UNIT 4 Data Link Layer

Functions of data link layer


•Framings: It splits packets which are obtained from the network layer into the controllable units known as
frames.
•Physical Addressing: It inserts a header to the frame to represent the physical address of the sender and
receiver of the frame.
•Error Control: This is the leading service of the data link layer. It helps the protocols to identify error frames
and to provide the communication of accurate frames.
•Flow Control: It supports a flow control structure to prevent a quick transmitter from defeating a slow
receiver by buffering more bits.
•Access Control: The data link layer protocol decides which device has control over the connection at any
provided time, when the other systems are linked to a parallel connection.

What is an Error
 The data can be corrupted during transmission (from source to receiver).
 It may be affected by external noise or some other physical imperfections.
 In this case, the input data is not same as the received output data. This mismatched data is called
“Error”.
Types Of Errors
In a data sequence, if 1 is changed to zero or 0 is changed to 1, it is called “Bit error”.
There are generally 3 types of errors occur in data transmission from transmitter to receiver. They are
• Single bit errors
• Multiple bit errors
• Burst errors
Single Bit Data Errors
 The change in one bit in the whole data sequence , is called “Single bit
error”.
 Occurrence of single bit error is very rare in serial communication
system.
 This type of error occurs only in parallel communication system, as
data is transferred bit wise in single line, there is chance that single line to be
noisy.

Multiple Bit Data Errors


 If there is change in two or more bits of data sequence of
transmitter to receiver, it is called “Multiple bit error”.
 This type of error occurs in both serial type and parallel type data
communication networks.

Marks: 12 Page 1
UNIT 4 Data Link Layer

Burst Errors
 The change of set of bits in data sequence is called “Burst error”. The burst error is calculated in from
the first bit change to last bit change.

Ways of doing Error Control :


There are basically two ways of doing Error control as given below :

1. Error Detection :
Error detection, as name suggests, simply means detection or identification of errors. These errors may
cause due to noise or any other impairments during transmission from transmitter to the receiver, in
communication system. It is class of technique for detecting garbled i.e. unclear and distorted data or
message.

2. Error Correction :
Error correction, as name suggests, simply means correction or solving or fixing of errors. It simply means
reconstruction and rehabilitation of original data that is error-free. But error correction method is very costly
and is very hard.
3.
Error Detecting Codes
In digital communication system errors are transferred from one communication system to another, along with
the data. If these errors are not detected and corrected, data will be lost . For effective communication, data
should be transferred with high accuracy .This can be achieved by first detecting the errors and then correcting
them.Error detection is the process of detecting the errors that are present in the data transmitted from
transmitter to receiver, in a communication system. We use some redundancy codes to detect these errors, by
adding to the data while it is transmitted from source (transmitter). These codes are called “Error detecting
codes”.
Types of Error detection
1. Hamming Code
2. Cyclic Redundancy Check (CRC)
3. Linear block code
4. Check Sum
Marks: 12 Page 2
UNIT 4 Data Link Layer

Hamming code
Even Parity
 If the data has even number of 1’s, the parity bit is 0. Ex: data is 10000001 -> parity bit 0
 Odd number of 1’s, the parity bit is 1. Ex: data is 10010001 -> parity bit 1
Odd Parity
 If the data has odd number of 1’s, the parity bit is 0. Ex: data is 10011101 -> parity bit 0
 Even number of 1’s, the parity bit is 1. Ex: data is 10010101 -> parity bit 1
Generate hamming code for message 1011 using even parity

Ans: m= message bit= no of bits in message= 4

Calculate r for m=4

Consider r=1

2^1>=4+1+1

2>=6

2^1>=6= condition not satisfied

Consider r=2

2^2>=4+2+1

4>=7= condition not satisfied

Consider r=3

2^3>=4+3+1

8>=8

8=8 condition satisfied hence r=3

So message bit will be 4 and parity bit will be 3

i.e. length of total message =m+r=4+3=7

it is written as (7,4) i.e 7 bit message with 4 bit of message

Marks: 12 Page 3
UNIT 4 Data Link Layer

so total 7 bit is a combination of 4 bit message and 3 bit parity

Parity bit place in overall message

Parity bit always located at 2^r position

1st parity bit location= 2^0= 1

2nd parity bit location= 2^1=2

3rd parity bit location- 2^2=4

MESSAGE BIT= 1011= M4 M3 M2 M1

Bit position 7th 6th 5th 4th 3rd 2nd 1st


Parity bit P P P
Message bit M4 M3 M2 M1
1 0 1 1

Calculate parity bit

P1= 1 XOR 3 XOR 5 XOR 7= P1 XOR 1 XOR 0 XOR 1= P1 1 1 1= 1

P2= 2 XOR 3 XOR 6 XOR 7= P2 XOR 1 XOR 1 XOR 1= P2 1 0 1= 0

P4= 4 XOR 5 XOR 6 XOR 7= P3 XOR 0 XOR 1 XOR 1= P4 1 0 1= 0

Bit position 7th 6th 5th 4th 3rd 2nd 1st


Parity bit P4 P2 P1
Message bit M4 M3 M2 M1
1 0 1 1
FINAL
1 0 1 0 1 0 1
MESSAGE

FINAL HAMMING CODE WILL BE (1 0 1 0 1 0 1 )

This code will be send from sender to receiver

Marks: 12 Page 4
UNIT 4 Data Link Layer

Correction process-

Let’s consider 6th bit is sent incorrectly i.e 1 1 1 0 1 0 1 is sent then how to correct that error

Bit position 7th 6th 5th 4th 3rd 2nd 1st


Parity bit P P P
Message bit M4 M3 M2 M1
1 1 1 0 1 0 1

How to detect incorrect bit & correct it

E1= Error using P1= 1 3 5 7 = EOR (1 1 1 1 )= 0

E2= Error using P2= 2 3 6 7 = EOR (0 1 1 1)= 1

E3= Error using P3= 4 5 6 7 = EOR (0 1 1 1)= 1

SO output = E3 E2 E1 = 1 1 0 = 6 decimal= 6th bit is incorrect

We have received 6th bit as 1 which is wrong so 6th bit should be 0

Therefore correct message is 1 0 1 0 1 0 1

Let’s consider all bits sent correctly i.e 1 0 1 0 1 0 1 How to detect incorrect bit & correct it

E1= Error using P1= 1 3 5 7 = EOR ( 1 1 1 1)= 0

E2= Error using P2= 2 3 6 7 = EOR ( 0 1 0 1 )= 0

E3= Error using P3= 4 5 6 7 = EOR ( 0 1 0 1 )= 0

SO output = 0 0 0 = 0 decimal= 0th bit is incorrect i.e no correction required

We have received all bits correct

Therefore correct message is 1 0 1 0 1 0 1

Marks: 12 Page 5
UNIT 4 Data Link Layer

Cyclic Redundancy check (CRC)

Assume that g(x) is CRC-4, which equals X4 + X + 1, and the source data M is 10110011. In this case, the
divisor P is 10011.
The transmit end shifts M leftward by four bits, and divides the resulting number by P.

Marks: 12 Page 6
UNIT 4 Data Link Layer

Example of CRC calculation at the transmit end


The remainder is the CRC check code, which is 0100 in this example. The transmit end appends 0100 to the
original data frame 10110011 to generate a new frame 101100110100, and sends the new frame to the receive
end. When receiving this frame, the receive end divides the frame by the divisor P, and considers the frame
correct if the division leaves no remainder.

Marks: 12 Page 7
UNIT 4 Data Link Layer

Linear block code


The generator matrix for a (6,3) block code is given below. Find all the code vectors of this code.

Sol. (n, k) = (6,3)


n=6
k=3
n – k = 6 - 3 =3 number of parity bits.

Step1: Separate the identity matrix and coefficient matrixGenerator matrix is given by:

[𝐺] = [𝐼𝑘 | 𝑃]

(000) (001) (010) (011) (100) (101) (110) (111)

As the size of message block k =3, there are 8 possible message sequences

Ik P
= =

As the size of message block k =3, there are 8 possible message sequences

Step 2: Obtain parity vector C = MP

0 1 1
∴ [𝐶] = [𝑐0 𝑐2] = [𝑚0

𝑐0 = (𝑚0 . 0) ⊕ (𝑚1 . 1) ⊕ (𝑚2. 1)

= 0 ⊕ 𝑚1 ⊕ 𝑚2

= 𝑚1 ⊕ 𝑚2

For message word ( m𝟎 𝒎𝟏 𝒎𝟐 = 0 0 0)


𝑐0 = 𝑚1 ⊕ 𝑚2 = 0 ⊕ 0 = 0
𝑐1 = 𝑚0 ⊕ 𝑚21 =00 ⊕0 0 = 0
𝑐2 = 𝑚0 ⊕ 𝑚1 = 0 ⊕ 0 = 0

Marks: 12 Page 8
0 0
UNIT 4 Data Link Layer

 ⊕ 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝑀𝑜𝑑 − 2 𝑎𝑑𝑑𝑖𝑡𝑖𝑜𝑛


 ⊕ 𝑎𝑙𝑠𝑜 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝐸𝑥 − 𝑂𝑅 𝑙𝑜𝑔𝑖𝑐
 Addition and subtraction have same meaning in modulo-2 arithmetic
 modulo-2 addition is the EX-OR operation in logic and modulo-2 multiplication is the AND operation.
 Binary matrix multiplication follows the usual rules with mod-2 addition instead of conventional
addition.

Binary addition & multiplication:

Mod-2 addition and mod-2 multiplication on binary symbols 0 and 1. Multiplication defined same as for
ordinary numbers. But for addition 1 + 1 = 0. This can be interpreted as 1 – 1 = 0 i.e., in binary computations,
subtraction coincides with addition.
Mod-2 addition table
0⊕0=0 A B A ⊕ B = 𝐴̅ 𝐵 + 𝐴 𝐵̅
0⊕1=1 0 0 0
1⊕0=1 0 1 1
1⊕1=0 1 0 1
1 1 0
Mod-2 subtraction table Multiplication in modulo-2 algebra
Complete codeword for message block (000)
m0 m1 m2 c0 c1 c2
0 0 0 0 0 0

Parity bits for message word ( m𝟎 𝒎𝟏 𝒎𝟐 =


0 1 1

[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]

1 1 0

𝑐0 = 𝑚1 ⊕ 𝑚2

𝑐1 = 𝑚0 ⊕ 𝑚2

𝑐2 = 𝑚0 ⊕ 𝑚1

Complete codeword for message block (001)

m0 m1 m2 c0 c1 c2
0 0 1 1 1 0

Parity bits for message word ( m𝟎 𝒎𝟏 𝒎𝟐 = 0 1 0)

Marks: 12 Page 9
UNIT 4 Data Link Layer

𝑐0 = 𝑚1 ⊕ 𝑚2

𝑐1 = 𝑚0 ⊕ 𝑚2

𝑐2 = 𝑚0 ⊕ 𝑚1

0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2 ] [1 0 1]
1 1 0

Complete codeword for message block (001)

m0 m1 m2 c0 c1 c2
0 1 0 1 0 1

Parity bits for message word (m𝟎 𝒎𝟏 𝒎𝟐 = 0 1 1)


𝑐0 = 𝑚1 ⊕ 𝑚2
𝑐1 = 𝑚0 ⊕ 𝑚2
𝑐2 = 𝑚0 ⊕ 𝑚1
0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]
1 1 0

Complete codeword for message block (001)


m0 m1 m2 c0 c1 c2
0 1 1 0 1 1
Parity bits for message word (m𝟎 𝒎𝟏 𝒎𝟐 = 1 0 0)

𝑐0 = 𝑚1 ⊕ 𝑚2

𝑐1 = 𝑚0 ⊕ 𝑚2

𝑐2 = 𝑚0 ⊕ 𝑚1

0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]
1 1 0

Complete codeword for message block (100)

Marks: 12 Page 10
UNIT 4 Data Link Layer

m0 m1 m2 c0 c1 c2
1 0 0 0 1 1

Parity bits for message word (m𝟎 𝒎𝟏 𝒎𝟐 = 1 0 1)


𝑐0 = 𝑚1 ⊕ 𝑚2

𝑐1 = 𝑚0 ⊕ 𝑚2

𝑐2 = 𝑚0 ⊕ 𝑚1
0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]
1 1 0

Complete codeword for message block (001)


m0 m1 m2 c0 c1 c2
1 0 1 1 0 1
Parity bits for message word (m𝟎 𝒎𝟏 𝒎𝟐 = 1 1 0)
𝑐0 = 𝑚1 ⊕ 𝑚2
𝑐1 = 𝑚0 ⊕ 𝑚2
𝑐2 = 𝑚0 ⊕ 𝑚1
0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]
1 1 0
Complete codeword for message block (001)

m0 m1 m2 c0 c1 c2
1 1 0 1 1 0

Parity bits for message word (m𝟎 𝒎𝟏 𝒎𝟐 = 1 1 1)

𝑐0 = 𝑚1 ⊕ 𝑚2

𝑐1 = 𝑚0 ⊕ 𝑚2

𝑐2 = 𝑚0 ⊕ 𝑚1
0 1 1
[𝐶] = [𝑐0 𝑐1 𝑐2] = [𝑚0 𝑚1 𝑚2] [1 0 1]
1 1 0

Complete codeword for message block (111)


Marks: 12 Page 11
UNIT 4 Data Link Layer

m0 m1 m2 c0 c1 c2
1 1 1 0 0 0
Code vectors for (6,3) linear block code
S.No. Message vectors Parity bits Code vectors
1 000 000 000000
2 001 110 001110
3 010 101 010101
4 011 011 011011
5 100 011 100011
6 101 101 101101
7 110 110 110110
8 111 000 111000

Checksum:

Marks: 12 Page 12
UNIT 4 Data Link Layer

Flow control:
 Flow control is the management of data flow between computers or devices or between nodes in a
network so that the data can be handled at an efficient pace.
 Too much data arriving before a device can handle it causes data overflow, meaning the data is either
lost or must be retransmitted.
 Error control in data link layer is the process of detecting and correcting data frames that have been
corrupted or lost during transmission.
 In case of lost or corrupted frames, the receiver does not receive the correct data-frame and sender is
ignorant about the loss. Data link layer follows a technique to detect transit errors and take necessary
actions, which is retransmission of frames whenever error is detected or frame is lost. The process is
called Automatic Repeat Request (ARQ).

Phases in Error Control


The error control mechanism in data link layer involves the following phases −
 Detection of Error − Transmission error, if any, is detected by either the sender or the receiver.
 Acknowledgment − acknowledgment may be positive or negative.
o Positive ACK − On receiving a correct frame, the receiver sends a positive acknowledge.
o Negative ACK − On receiving a damaged frame or a duplicate frame, the receiver sends a
negative acknowledgment back to the sender.

Marks: 12 Page 13
UNIT 4 Data Link Layer

 Retransmission − The sender maintains a clock and sets a timeout period. If an acknowledgment of a
data-frame previously transmitted does not arrive before the timeout, or a negative acknowledgment is
received, the sender retransmits the frame.
Error Control Techniques
There are three main techniques for error control −

 Stop and Wait ARQ


This protocol involves the following transitions −
o A timeout counter is maintained by the sender, which is started when a frame is sent.
o If the sender receives acknowledgment of the sent frame within time, the sender is confirmed about
successful delivery of the frame. It then transmits the next frame in queue.
o If the sender does not receive the acknowledgment within time, the sender assumes that either the frame
or its acknowledgment is lost in transit. It then retransmits the frame.
o If the sender receives a negative acknowledgment, the sender retransmits the frame.

Working of Stop and Wait protocol

 The above figure shows the working of the stop and wait protocol.
 If there is a sender and receiver, then sender sends the packet and that packet is known as a data packet
 The sender will not send the second packet without receiving the acknowledgment of the first packet.
 The receiver sends the acknowledgment for the data packet that it has received.
 Once the acknowledgment is received, the sender sends the next packet. This process continues until all
the packet are not sent.
Marks: 12 Page 14
UNIT 4 Data Link Layer

 The main advantage of this protocol is its simplicity but it has some disadvantages also. For example, if
there are 1000 data packets to be sent, then all the 1000 packets cannot be sent at a time as in Stop and
Wait protocol, one packet is sent at a time.
Disadvantages of Stop and Wait protocol
The following are the problems associated with a stop and wait protocol:
1. Problems occur due to lost data

Suppose the sender sends the data and the data is lost. The receiver is waiting for the data for a long time. Since
the data is not received by the receiver, so it does not send any acknowledgment. Since the sender does not
receive any acknowledgment so it will not send the next packet. This problem occurs due to the lost data.
In this case, two problems occur:
Sender waits for an infinite amount of time for an acknowledgment.
Receiver waits for an infinite amount of time for a data.
2. Problems occur due to lost acknowledgment

Suppose the sender sends the data and it has also been received by the receiver. On receiving the packet, the
receiver sends the acknowledgment. In this case, the acknowledgment is lost in a network, so there is no chance
for the sender to receive the acknowledgment. There is also no chance for the sender to send the next packet as
in stop and wait protocol, the next packet cannot be sent until the acknowledgment of the previous packet is
received.
In this case, one problem occurs:
Sender waits for an infinite amount of time for an acknowledgment.
3. Problem due to the delayed data or acknowledgment
Suppose the sender sends the data and it has also been received by the receiver. The receiver then sends the
acknowledgment but the acknowledgment is received after the timeout period on the sender's side. As the
acknowledgment is received late, so acknowledgment can be wrongly considered as the acknowledgment of
some other data packet.

Marks: 12 Page 15
UNIT 4 Data Link Layer

Go-Back-N ARQ
The working principle of this protocol is −
o The sender has buffers called sending window.
o The sender sends multiple frames based upon the sending-window size, without receiving the
acknowledgment of the previous ones.
o The receiver receives frames one by one. It keeps track of incoming frame’s sequence number and sends
the corresponding acknowledgment frames.
o After the sender has sent all the frames in window, it checks up to what sequence number it has received
positive acknowledgment.
o If the sender has received positive acknowledgment for all the frames, it sends next set of frames.
o If sender receives NACK or has not receive any ACK for a particular frame, it retransmits all the frames
after which it does not receive any positive ACK.

Working of Go-Back-N ARQ


Suppose there are a sender and a receiver, and let's assume that there are 11 frames to be sent. These frames are
represented as 0,1,2,3,4,5,6,7,8,9,10, and these are the sequence numbers of the frames. Mainly, the sequence
number is decided by the sender's window size. But, for the better understanding, we took the running sequence
numbers, i.e., 0,1,2,3,4,5,6,7,8,9,10. Let's consider the window size as 4, which means that the four frames can
be sent at a time before expecting the acknowledgment of the first frame.
Step 1: Firstly, the sender will send the first four frames to the receiver, i.e., 0,1,2,3, and now the sender is
expected to receive the acknowledgment of the 0th frame.

Marks: 12 Page 16
UNIT 4 Data Link Layer

Let's assume that the receiver has sent the acknowledgment for the 0 frame, and the receiver has successfully
received it.

The sender will then send the next frame, i.e., 4, and the window slides containing four frames (1,2,3,4).The
receiver will then send the acknowledgment for the frame no 1. After receiving the

acknowledgment, the sender will send the next frame, i.e., frame no 5, and the window will slide having four
frames (2,3,4,5).

Now, let's assume that the receiver is not acknowledging the frame no 2, either the frame is lost, or the
acknowledgment is lost. Instead of sending the frame no 6, the sender Go-Back to 2, which is the first frame of
the current window, retransmits all the frames in the current window, i.e., 2,3,4,5.

Marks: 12 Page 17
UNIT 4 Data Link Layer

Important points related to Go-Back-N ARQ:


 In Go-Back-N, N determines the sender's window size, and the size of the receiver's window is always 1.
 It does not consider the corrupted frames and simply discards them.
 It does not accept the frames which are out of order and discards them.
 If the sender does not receive the acknowledgment, it leads to the retransmission of all the current window
frames.
Let's understand the Go-Back-N ARQ through an example.
Example 1: In GB4, if every 6th packet being transmitted is lost and if we have to spend 10 packets then how
many transmissions are required?
Solution: Here, GB4 means that N is equal to 4. The size of the sender's window is 4.
Step 1: As the window size is 4, so four packets are transferred at a time, i.e., packet no 1, packet no 2, packet
no 3, and packet no 4.

Marks: 12 Page 18
UNIT 4 Data Link Layer

Step 2: Once the transfer of window size is completed, the sender receives the acknowledgment of the first
frame, i.e., packet no1. As the acknowledgment receives, the sender sends the next packet, i.e., packet no 5. In
this case, the window slides having four packets, i.e., 2,3,4,5 and excluded the packet 1 as the acknowledgment
of the packet 1 has been received successfully.

Step 3: Now, the sender receives the acknowledgment of packet 2. After receiving the acknowledgment for
packet 2, the sender sends the next packet, i.e., packet no 6. As mentioned in the question that every 6th is being
lost, so this 6th packet is lost, but the sender does not know that the 6th packet has been lost.

Step 4: The sender receives the acknowledgment for the packet no 3. After receiving the acknowledgment of
3rd packet, the sender sends the next packet, i.e., 7th packet. The window will slide having four packets, i.e., 4,
5, 6, 7.

Marks: 12 Page 19
UNIT 4 Data Link Layer

Step 5: When the packet 7 has been sent, then the sender receives the acknowledgment for the packet no 4.
When the sender has received the acknowledgment, then the sender sends the next packet, i.e., the 8th packet.
The window will slide having four packets, i.e., 5, 6, 7, 8.

Step 6: When the packet 8 is sent, then the sender receives the acknowledgment of packet 5. On receiving the
acknowledgment of packet 5, the sender sends the next packet, i.e., 9th packet. The window will slide having
four packets, i.e., 6, 7, 8, 9.

Marks: 12 Page 20
UNIT 4 Data Link Layer

Step 7: The current window is holding four packets, i.e., 6, 7, 8, 9, where the 6th packet is the first packet in the
window. As we know, the 6th packet has been lost, so the sender receives the negative acknowledgment NAK(6).
As we know that every 6th packet is being lost, so the counter will be restarted from 1. So, the counter values 1,
2, 3 are given to the 7th packet, 8th packet, 9th packet respectively.

Step 8: As it is Go-BACK, so it retransmits all the packets of the current window. It will resend 6, 7, 8, 9. The
counter values of 6, 7, 8, 9 are 4, 5, 6, 1, respectively. In this case, the 8th packet is lost as it has a 6-counter
value, so the counter variable will again be restarted from 1.

Step 9: After the retransmission, the sender receives the acknowledgment of packet 6. On receiving the
acknowledgment of packet 6, the sender sends the 10th packet. Now, the current window is holding four
packets, i.e., 7, 8, 9, 10.

Marks: 12 Page 21
UNIT 4 Data Link Layer

Step 10: When the 10th packet is sent, the sender receives the acknowledgment of packet 7. Now the current
window is holding three packets, 8, 9 and 10. The counter values of 8, 9, 10 are 6, 1, 2.

Step 11: As the 8th packet has 6 counter value which means that 8th packet has been lost, and the sender
receives NAK (8).

Step 12: Since the sender has received the negative acknowledgment for the 8th packet, it resends all the
packets of the current window, i.e., 8, 9, 10.

Marks: 12 Page 22
UNIT 4 Data Link Layer

Step 13: The counter values of 8, 9, 10 are 3, 4, 5, respectively, so their acknowledgments have been received
successfully.
We conclude from the above figure that total 17 transmissions are required.
Selective Repeat ARQ
 Both the sender and the receiver have buffers called sending window and receiving window
respectively.
 The sender sends multiple frames based upon the sending-window size, without receiving the
acknowledgment of the previous ones.
 The receiver also receives multiple frames within the receiving window size.
 The receiver keeps track of incoming frame’s sequence numbers, buffers the frames in memory.
 It sends ACK for all successfully received frames and sends NACK for only frames which are missing
or damaged.
 The sender in this case, sends only packet for which NACK is received.

Selective Repeat ARQ


 Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request. It is a data link
layer protocol that uses a sliding window method. The Go-back-N ARQ protocol works well if it has
fewer errors. But if there is a lot of error in the frame, lots of bandwidth loss in sending the frames
again. So, we use the Selective Repeat ARQ protocol. In this protocol, the size of the sender window is
always equal to the size of the receiver window. The size of the sliding window is always greater than 1.
 If the receiver receives a corrupt frame, it does not directly discard it. It sends a negative
acknowledgment to the sender. The sender sends that frame again as soon as on the receiving negative

Marks: 12 Page 23
UNIT 4 Data Link Layer

acknowledgment. There is no waiting for any time-out to send that frame. The design of the Selective
Repeat ARQ protocol is shown below.

The example of the Selective Repeat ARQ protocol is shown below in the figure.

Explanation
Step 1 − Frame 0 sends from sender to receiver and set timer.
Step 2 − Without waiting for acknowledgement from the receiver another frame, Frame1 is sent by sender by
setting the timer for it.
Step 3 − In the same way frame2 is also sent to the receiver by setting the timer without waiting for previous
acknowledgement.
Step 4 − Whenever sender receives the ACK0 from receiver, within the frame 0 timer then it is closed and sent
to the next frame, frame 3.
Step 5 − whenever the sender receives the ACK1 from the receiver, within the frame 1 timer then it is closed
and sent to the next frame, frame 4.

Marks: 12 Page 24
UNIT 4 Data Link Layer

Step 6 − If the sender doesn’t receive the ACK2 from the receiver within the time slot, it declares timeout for
frame 2 and resends the frame 2 again, because it thought the frame2 may be lost or damaged.

Difference between the Go-Back-N ARQ and Selective Repeat ARQ?


Go-Back-N ARQ Selective Repeat ARQ

If a frame is corrupted or lost in it,all In this, only the frame is sent again, which is corrupted or
subsequent frames have to be sent again. lost.

If it has a high error rate,it wastes a lot of There is a loss of low bandwidth.
bandwidth.

It is less complex. It is more complex because it has to do sorting and


searching as well. And it also requires more storage.

It does not require sorting. In this, sorting is done to get the frames in the correct
order.

Marks: 12 Page 25
UNIT 4 Data Link Layer

It does not require searching. The search operation is performed in it.

It is used more. It is used less because it is more complex.

PPP Frame
PPP is a byte - oriented protocol where each field of the frame is composed of one or more bytes. The fields of
a PPP frame are −
 Flag − 1 byte that marks the beginning and the end of the frame. The bit pattern of the flag is 01111110.
 Address − 1 byte which is set to 11111111 in case of broadcast.
 Control − 1 byte set to a constant value of 11000000.
 Protocol − 1 or 2 bytes that define the type of data contained in the payload field.
 Payload − This carries the data from the network layer. The maximum length of the payload field is
1500 bytes. However, this may be negotiated between the endpoints of communication.
 FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code used is CRC
(cyclic redundancy code)

Byte Stuffing in PPP Frame − Byte stuffing is used is PPP payload field whenever the flag sequence appears
in the message, so that the receiver does not consider it as the end of the frame. The escape byte, 01111101, is
stuffed before every byte that contains the same byte as the flag byte or the escape byte. The receiver on
receiving the message removes the escape byte before passing it onto the network layer.

Services Provided by PPP


The main services provided by Point - to - Point Protocol are −
 Defining the frame format of the data to be transmitted.
 Defining the procedure of establishing link between two points and exchange of data.
 Stating the method of encapsulation of network layer data in the frame.
 Stating authentication rules of the communicating devices.
 Providing address for network communication.
 Providing connections over multiple links.
 Supporting a variety of network layer protocols by providing a range os services.

Transition Phases Of A PPP Protocol:


 Dead: Dead is a transition phase which means that the link is not used or there is no active carrier at the
physical layer.
 Establish: If one of the nodes starts working then the phase goes to the establish phase. In short, we can
say that when the node starts communication or carrier is detected then it moves from the dead to the
establish phase.
Marks: 12 Page 26
UNIT 4 Data Link Layer

 Authenticate: It is an optional phase which means that the communication can also moves to the
authenticate phase. The phase moves from the establish to the authenticate phase only when both the
communicating nodes agree to make the communication authenticated.
 Network: Once the authentication is successful, the network is established or phase is network. In this
phase, the negotiation of network layer protocols take place.
 Open: After the establishment of the network phase, it moves to the open phase. Here open phase
means that the exchange of data takes place. Or we can say that it reaches to the open phase after the
configuration of the network layer.
 Terminate: When all the work is done then the connection gets terminated, and it moves to the
terminate phase.

Techniques of Flow Control in Data Link Layer : There are basically two types of techniques being
developed to control the flow of data

Marks: 12 Page 27
UNIT 4 Data Link Layer

1. Stop-and-Wait Flow Control : This method is the easiest and simplest form of flow control. In this
method, basically message or data is broken down into various multiple frames, and then receiver indicates its
readiness to receive frame of data. When acknowledgement is received, then only sender will send or transfer
the next frame. This process is continued until sender transmits EOT (End of Transmission) frame. In this
method, only one of frames can be in transmission at a time. It leads to inefficiency i.e. less productivity if
propagation delay is very much longer than the transmission delay and Ultimately In this method sender sent
single frame and receiver take one frame at a time and sent acknowledgement(which is next frame number
only) for new frame.
Advantages –
This method is very easiest and simple and each of the frames is checked and acknowledged well.
This method is also very accurate.
Disadvantages –
This method is fairly slow.
In this, only one packet or frame can be sent at a time.
It is very inefficient and makes the transmission process very slow.
2. Sliding Window Flow Control : This method is required where reliable in-order delivery of packets
or frames is very much needed like in data link layer. It is point to point protocol that assumes that none of the
other entity tries to communicate until current data or frame transfer gets completed. In this method, sender
transmits or sends various frames or packets before receiving any acknowledgement. In this method, both the
sender and receiver agree upon total number of data frames after which acknowledgement is needed to be
transmitted. Data Link Layer requires and uses this method that simply allows sender to have more than one
unacknowledged packet “in-flight” at a time. This increases and improves network throughput. and
Ultimately In this method sender sent multiple frame but receiver take one by one and after completing one
frame acknowledge(which is next frame number only) for new frame.
Advantages –
It performs much better than stop-and-wait flow control.
This method increases efficiency.
Multiples frames can be sent one after another.
Disadvantages –
The main issue is complexity at the sender and receiver due to the transferring of multiple frames.
The receiver might receive data frames or packets out the sequence.

Marks: 12 Page 28

You might also like