Data Link Control

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 36

Data Link

Control

FLOW AND ERROR CONTROL


The most important responsibilities of the data link
layer are flow control and error control. Collectively,
thesefunctionsareknownasdatalinkcontrol.

Topics discussed in this section:


Flow Control
Error Control

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.

Note
Error control in the data link layer is based
on automatic repeat request, which is the
retransmission of data.

PROTOCOLS

Now let us see how the data link layer can combine
framing, flow control, and error control to achieve the
delivery of data from one node to another. The protocols
are normally implemented in software by using one of
the common programming languages.

Taxonomy of protocols

NOISELESS CHANNELS
Let us first assume we have an ideal channel in which
no frames are lost, duplicated, or corrupted. We
introduce two protocols for this type of channel.

Topics discussed in this section:


Simplest Protocol
Stop-and-Wait Protocol

The design of the simplest protocol with no flow or error control

Flow diagram

Design of Stop-and-Wait Protocol

Flow diagram

NOISY CHANNELS
Although the Stop-and-Wait Protocol gives us an idea
of how to add flow control to its predecessor, noiseless
channels are nonexistent. We discuss three protocols in
this section that use error control.

Topics discussed in this section:


Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request

Note
Error correction in Stop-and-Wait ARQ is
done by keeping a copy of the sent frame
and retransmitting of the frame when the
timer expires.

Note
In Stop-and-Wait ARQ, we use sequence numbers
to number the frames. The sequence numbers are
based on modulo-2 arithmetic.
In Stop-and-Wait ARQ, the acknowledgment
number always announces in modulo-2 arithmetic
the sequence number of the next frame expected.

Flow and Error Control


Mechanisms
Flow and Error
control Mechanisms
for Noisy Channel

Stop-AND-WAIT
ARQ

Go-BACK-N
ARQ

SELECTIVE REPEAT
ARQ

Stop-and-Wait ARQ
Keep a copy of the frame until ACK is received.
Frame 0 is acknowledged by ACK 1 and viceversa.
Lost and corrupted frames are considered as
same and No ACK is sent.
Senders control variable
S = holds number of recently sent frame
Receivers control variable
R = holds number of the next frame expected
Sender starts a timer when it sends a frame.
If an ack does not arrive within an allotted time
period, sender assumes that packet is corrupted
or lost. Sender will resend the same packet.

Operation of Stop-and-Wait ARQ


1. Normal Operation
2. Frame is lost
3. Acknowledgment is lost
4. Acknowledgment is delayed

Operation of Stop-and-Wait ARQ


Frame is lost

Operation of Stop-and-Wait ARQ

lost ACK frame

In Stop-and-Wait ARQ, numbering frames prevents the


retaining of duplicate frames.

Stop-and-Wait ARQ, delayed ACK


The value of R at the receiver site is still 1, which means
the receiver expects to see frame 1.
Numbered acknowledgments are needed if an
acknowledgment is delayed and the next frame is lost.

Piggybacking
Bidirectional transmission
Method to combine a data frame with
an acknowledgement.

Go-back-N ARQ
Sending multiple frames at a time.
Keep the copy of the frames before ACK is received.
Sequence number is included in each frame in the
header. If there are m bits for sequence number then
we can have maximum 2m 1.
Sender Sliding Window
Window size is fixed here.

Note

In the Go-Back-N Protocol, the


sequence numbers are modulo 2m,
where m is the size of the sequence
number field in bits.

Send window for Go-Back-N ARQ

Note

The send window is an abstract concept


defining an imaginary box of size 2m 1
with three variables: Sf, Sn, and Ssize.

Note

The send window can slide one


or more slots when a valid
acknowledgment arrives.

Receive window for Go-Back-N ARQ

Note

The receive window is an abstract


concept defining an imaginary box
of size 1 with one single variable Rn.
The window slides
when a correct frame has arrived;
sliding occurs one slot at a time.

Design of Go-Back-N ARQ

Window size for Go-Back-N ARQ

Note

In Go-Back-N ARQ, the size of the


send window must be less than 2m;
the size of the receiver window
is always 1.

Go-Back-N ARQ, normal


operation

Go-Back-N ARQ, lost frame

Frame 2 is lost. When the receiver receives frame 3, it is


discarded because the receiver is expecting frame 2,
not frame 3 (according to its window)
Acknowledgements are cumulative

Go-Back-N ARQ: sender window size

If size of window is less than 2m, and all three ACK are
lost, the frame 0 timer expires and all three frames are
resent. Receiver discards them as duplicate.
If size of window is equal to 2m, and all three ACK are
lost, sender will send the duplicate frame 0 but receiver
will accept it as next frame as it expects that

Selective Repeat ARQ, lost frame

Selective Repeat ARQ, sender window size

Size of window is 2 and all acknowledgements are lost,


the timer for frame 0 expires and frame 0 is resent.
Receiver is expecting frame 2, not frame 0, so this
duplicate frame is correctly discarded.
Size of window is 3 and all acknowledgements are lost,
the sender sends a duplicate of frame 0. Receiver
expects 0 as part of window and so accepts it.

You might also like