Datalink Layer
Protocols
or
Data Link Control
and Protocols
Flow and Error Control
The most important responsibilities of the
data link layer are flow control and error
control. these functions are known as :
Data Link Control.
Data must be checked and processed before they
can be used.
The rate of such processing is often slower than
the rate of transmission.
So, each receiver has a buffer to store incoming
data until they are processed.
If buffer begin to fill up, the sender must slow or
halt transmission.
Note
Flow control refers to a set of procedures used to
restrict the amount of data that the sender can send
before waiting for acknowledgment.
Error control :
•It is both Error Detection and Correction.
•Error correction in data link layer means: anytime an
error is detected in exchange, specified frames are
retransmitted.
•This process is called Automatic Repeat Request
Error control in the data link layer is based on
Automatic Repeat Request (ARQ), which is the
retransmission of data.
If the sender transmits data too quickly, it can lead
to:
•Data Loss,
(@ Receiver’s end)
•Congestion,
•Buffer Overflow
Stop & Wait Protocol
Primitives of Stop & Wait
@Sender Protocol:
Rule 1: Send only One data packet at a time.
Rule 2: Send the next packet only after receiving ACK from the previous
packet.
@Receiver
Rule 1: Receive and consume data packet.
Rule 2: After consuming packet, ACK need to be sent (Flow Control)
Stop and Wait Protocol
Stop & Wait Protocol ARQ
(Automatic Repeat Request)
Idea of Stop & Wait protocol is : After Transmitting
one frame, the sender waits for an ACK before
transmitting the next Frame
But, in Stop & Wait ARQ Protocol:
A transmitter /sender sends a frame then stops and waits for an
acknowledgment.
If the sender does not receive an ACK within a
Timeout Period, it resends the packet.
i.e., Stop and Wait ARQ =
The ACK is received before
the Timer Expires,
The original frame is Lost
The ACK is Lost
The Timeout fires too soon
Stop-and-Wait ARQ has the following features:
The sending device keeps a copy of the sent frame transmitted
until it receives an acknowledgment( ACK)
The sender starts a timer when it sends a frame.
If an ACK is not received within an allocated time period, the
sender resends it
Both frames and acknowledgment (ACK) are numbered
alternately 0 and 1( two sequence number only)
This numbering allows for identification of frames in case of
duplicate transmission
Stop-and-Wait ARQ
Cases of Operations:
[Link] operation
[Link] frame is lost
[Link] Acknowledgment (ACK) is lost
[Link] ACK is delayed
1. Normal Operation
The sender will not
send the next frame
until it is sure that the
current one is
correctly receive
sequence number is
necessary to check for
duplicated frames
2. Lost or damaged frame
A damage or lost frame
treated by the same manner
by the receiver.
No NACK when frame is
corrupted / duplicate
3. Lost ACK frame
Importance of frame
numbering
Note
In Stop and-Wait ARQ, numbering frames
prevents the retaining of duplicate frames.
4. Delayed ACK and lost frame
Importance of frame numbering
Note
Numbered acknowledgments are needed if an
acknowledgment is delayed and the next frame
is lost.
10.
Piggybacking ( Bidirectional transmission)
Is a method to combine a data frame with an
acknowledgment. ( it saves bandwidth as frame & ack
combined)
• Limitation of Stop & wait ARQ:
• One frame at a time
• After each frame sent the host must wait for an ACK
• Inefficient use of bandwidth & Poor performance.
To improve efficiency ACK should be sent after multiple
frames
Alternatives: Sliding Window protocol
Go-back-N ARQ
Selective Repeat ARQ
Pipelining: A task is begun before the previous task has
ended
There is no pipelining in stop and wait ARQ because we
need to wait for a frame to reach the destination and be
acknowledged before the next frame can be sent
Pipelining improves the efficiency of the transmission
Sliding window protocol
Sliding window protocols apply Pipelining :
Send multiple frames at a time.
No. of frames to be sent is based on Window Size.
Each frame is numbered : called as Sequence Number
Go_Back _N ARQ
Go_Back _N ARQ
• where N is the Sender's Window size.
• The [Link] frames that can be sent depends on the
window size of the Sender.
• It uses the concept of Protocol PIPELING, i.e., the
sender can send multiple frames before receiving
the ACK for the first frame.
• There are finite [Link] frames and the frames are
numbered in a sequential manner.
• If the ACK of a frame is not received within an
agreed upon time period, then
• ALL FRAMES IN THE CURRENT WINDOW ARE RE-
TRANSMITTED
The size of the sending window determines the
sequence number of the OUTBOUND Frames.
i.e.,
N = Sender's window size = 4 , then sequence
number will be 0,1,2,3,0,1,2,3.....
The number of bits in the sequence number is 2 to
generate the binary sequence 00,01,10,11
The sender is waiting for Frame2’s ACK
Frame 2 might be Lost OR
Frame 2's ACK might be Lost
Frame 0, 1 -> ACK is received,
But, Frame 2 ACK Not Received (when timeout),
So, The Current Window ALL THE FRAMES WILL
RETRANSMIT,
As Frame 2's ACK not received,
All the earlier frames in the current window ( 2,3,4,5) are
discarded,
and 2,3,4,5 are retransmitted.
Note
Stop-and-Wait ARQ is a special case of
Go-Back-N ARQ in which the size of the
send window is 1
10.
Selective
Repeat ARQ
Selective Repeat ARQ:
Only the Erroneous or Lost frames are retransmitted, while correct
frames are buffered.
i.e, number of retransmission are Less (unlike Go back N ARQ,
transmits more retransmissions)
The receiver while keeping track of sequence numbers, buffers the
frames in memory and sends NACK (Negative ACK) for only frame
which is missing or damaged.
The sender Retransmits packets for which NACK is received.