Data link
control
Line discipline
ErroR control
Flow control
introduction
Data Link Control
Line Discipline
Who should send now?
Flow Control
How much data may be
sent
before
receiving
acknowledgement?
Error Control
How can errors be
detected and corrected?
Line discipline
This can be done in two ways:
Enquiry
/acknowledgement
method
Poll /Select method
(ENQ/ACK)
(ENQ/ACK) method
By this way one station ensure that the other
is ready or not.
A is sender and B is receiver. A first sends an
enquiry(ENQ) frame asking if the receiver is
ready to accept data.
If
the
receiver
is
ready, it
sends
acknowledgement (ACK) frame else it sends
(NAK) negative acknowledgement frame.
(ENQ/ACK) method
If neither an ACK nor a NAK is received within
a specified time limit sender assumes that the
ENQ frame was lost, so it sends a replacement.
Sender make 3 such attempts before giving up.
If NAK comes for 3 times , the sender
disconnects and begins everything at another
time.
If the response is ACK, sender will send data.
At the end sender sends (EOT) end of
transmission frames.
(ENQ/ACK) method
Sender
Receiver
ENQ
ACK
D ata
ACK
EOT
Poll/select method
This works with the system where there is a
primary station and many secondary stations.
All are connected by same channel
Each secondary device have a unique
address.
Only one transmission can occur at a time.
Primary
Secondary
A
Secondary
B
Secondary
C
select method
When primary wants to send data to a
particular secondary, it transmits a select (SEL)
frame, one field of which includes the address
of the intended secondary.
As all secondary devices are connected by a
single link so each one checks the address
field.
When a secondary recognizes its own
address, it opens the frame and reads that
information that the data are forthcoming.
select method
If the secondary is awake and running it
returns an ACK frame to the primary.
Then the primary sends one or more data
frames, each addressed to the intended
secondary.
select method
S1
Primary
SEL
ACK
D ata
ACK
S2
S3
Poll method
When the primary is ready to receive the data ,
it polls(ask) each device to send data.
The device responds either NAK if it has
nothing to send or with data.
If the response is NAK the primary polls the
next secondary until it finds one with data to
send.
When the response is positive the primary
reads
the
frame
and
sends
an
acknowledgement (ACK) to the secondary. The
secondary may now send frames one after
another.
poll method
Flow control
Flow control refers to a set of procedures
used to restrict the amount of data the sender
can send before waiting for acknowledgement.
Buffer: each receiving device has a block of
memory called a buffer, reserved for storing
incoming data until they are processed.
If buffer begins to fill up receiver tells the send
to control the flow of data or halt the
transmission until it is again ready to receive
data.
Flow control
Flow Control
Stop and wait
Sliding
window
Send one frame at a
time
Send several frames at a
time
Stop and wait
The sender sends one frame and waits for an
acknowledgement before sending the next
frame.
Disadvantage: Stop and wait is slow.
Stop and wait
Sender
Receiver
D ata
Wait
time
ACK
D ata
Wait
time
ACK
Sliding window method
In this method several frames can be in transit
at a time.
The receiver acknowledges multiple frames by
a single acknowledgement.
Sliding window: it refers to the imaginary
boxes at both sender and receivers side.
It provides the upper limit on the number of
frames that can be transmitted before requiring
an acknowledgement.
Sliding window method
All the frames are numbered using Modulo n
arithmetic, means 0 to n-1. Ex. if n=8, frames are
0,1,2,3,4,5,6,7,0,1,2,3
The size of the window = n-1, for this case 7.
At a time more than one frames can be
transmitted when receiver sends an ACK, it
includes the number of next frame it wants to
receive. E.g to acknowledge the receipt of
frames end with 4, ACK contains number 5
which signifies , upto frame 4 data have been
received.
senders window
The window expands to
allow number of new
frames equal to the
number of frames
acknowledged by that
ACK.
receivers window
An example
Receiver Side
Sender Side
1 2 3 4 5 6 7 0 1 2
1 2 3 4 5 6 7 0 1 2
1 2 3 4 5 6 7 0 1 2
Data 0
1 2 3 4 5 6 7 0 1 2
1 2 3 4 5 6 7 0 1 2
Data 1
1 2 3 4 5 6 7 0 1 2
1 2 3 4 5 6 7 0 1 2
ACK 2
1 2 3 4 5 6 7 0 1 2
Error control method
Error control in data link layer is based on
automatic repeat request (ARQ) i.e, anytime an
error is detected in an exchange , a NAK is
returned and the specified frames are
retransmitted.
Retransmission occurs for 3 cases: damaged
frames,
lost
frames
and
lost
acknowledgements.
Error control method
Error Control
Stop and wait ARQ
Sliding window ARQ
Go-back-n
Selective Reject
Stop and wait ARQ
4 new points are added to the basic one.
Sender keeps a copy of the last frame
transmitted until it receives ACK for that frame.
Both data and ACK frames are numbered
alternatively 0 and 1. A data 0 is acknowledged
by ACK 1.
If an error is discovered in a data frame, a NAK
is returned. NAK is not numbered.
Sending device must have a timer.
Stop and wait ARQ: damaged frames
Sender
Receiver
Data 0
ACK 1
No error
Data 1
ACK 0
Data 0
NAK
No error
Error in
Frame 0
Data 0
ACK 1
No error
Stop and wait ARQ: lost frames
Sender
Receiver
D ata 0
Time out
Lost
Data 0
ACK 1
Stop and wait ARQ: lost acknowledgement
Sender
Receiver
Data 0
Time out
Lost
ACK 1
No error
Data 0
ACK 1
Second
copy
Discarded
sLiding window ARQ
3 new points are added to the basic one.
Sender keeps copies of all transmitted frames
until they have been acknowledged.
Both ACK and NAK frames must be numbered.
ACK carries the number of the next frame
expected. NAK carries the number of the
damaged frame itself.
Frames without errors need not to be
acknowledged individually but every damaged
frame must be acknowledged separately.
Sender must have a timer.
Go-back-n ARQ: damaged frames
In this , if one frame is lost or damaged all
frames sent are retransmitted since the last
frame acknowledged.
Go-back-n ARQ: damaged frames
Sender
Receiver
Da t a 0
Data 1
No error
Da t a 2
ACK 3
Data 3
Data 4
Da t a 5
NAK 3
Resent
Resent
Resent
Da t a 3
Data 4
Da t a 5
Error, Discarded
Discarded
Discarded
Go-back-n ARQ: lost frames
In this , data frames must be received in
sequence.
Go-back-n ARQ: lost frames
Sender
Receiver
Da t a 0
Data 1
Da t a 2
Data 3
Data 4
NAK 2
Resent
Resent
Resent
Da t a 2
Data 3
Da t a 4
Lost
Out of sequence,
discarded
Go-back-n ARQ: lost acknowledgement
Sender
Receiver
Da t a 0
Data 1
Time out
AC K 2
Resent
Resent
Lost
Da t a 0
Data 1
Discarded
Discarded
assignments
What is selective reject ARQ?
How damaged , lost frame and lost
acknowledgements are managed using this
procedure?