You are on page 1of 31

Chapter 11

Data Link
Control
(DLC)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11-1 DLC SERVICES

The data link control (DLC) deals with procedures for


communication between two
adjacent nodes no matter whether the link is dedicated
or broadcast.

Data link control functions include framing and flow


and error control.

11.2
111.11.1 Framing

The data-link layer needs to pack bits into frames, so that


each frame is distinguishable from another.

Our postal system practices a type of framing. The


simple act of inserting a letter into an envelope
separates one piece of information from another; the
envelope serves as the delimiter.

Framing in the data-link layer separates a message from


one source to a destination by adding a sender address
and a destination address. The destination address
defines where the packet is to go; the sender address
helps the recipient acknowledge the receipt.

11.3
Figure 111.1: A frame in a character-oriented protocol

11.4
111.11.2 Flow and Error Control

One of the responsibilities of the data-link control


sublayer is flow and error control at the data-link
layer.

11.5
11-2 DATA-LINK LAYER PROTOCOLS

Traditionally four protocols have been defined for the


data-link layer to deal with flow control:

Simple, Stop-and-Wait, Go-Back-N, and Selective-


.
Repeat

11.6
111.2.1 Simple Protocol

Our first protocol is a simple protocol with


neither flow nor error control. We assume that
the receiver can immediately handle any frame it
receives. In other words, the receiver can never
be overwhelmed with incoming frames. Figure
111.7 shows the layout for this protocol.

Figure 111.7: Simple protocol

11.7
Example 111.2
Figure 111.9 shows an example of communication
using this protocol. It is very simple. The sender sends
frames one after another without even thinking about
the receiver.

Figure 111.9: Flow diagram for Example 111.2


11.8
111.2.2 Stop-and-Wait Protocol

Stop-and-Wait protocol, uses both flow and error control.


In this protocol, the sender sends one frame at a time and waits for an
acknowledgment before sending the next one.
•Stations(Nodes/Machine) are equipped with the timer.

•Timer gets started every time when the frame is send by the sender .

•Frames are alternatively numbered with 0 or 1.

Different Cases:
Case 1: If the send Frame is lost then the Acknowledgement for the send
frame is not received before the timer expires then the same Frame has to
be resent again.

Case 2:If the Acknowledgement is lost, (it means that Frame is correctly
received by the receiving station and acknowledgement for the received
frame is lost due to which the Acknowledgement will not reach to the source
before the timer expires , so the source assumes that the Frame is lost so it
will resend the same frame again . As a result of it the receiver will receive
the same Frame twice.
11.9
How to identify the Duplicate Frames
A modulo 2 numbering scheme is used in which frames are
alternatively labeled with 0 or 1.

•Suppose the receiver sends ACK 1 it means that the previous


frame is received by the receiver and now the receiver is
expecting the next Frame with number 1, but the ACK is lost
and it never reaches to the source before the timer expires, So
Sender assumes that its Frame 0 is lost so it resend the Frame
0.

•On the other end the receiver is expecting Frame 1 but it


receives Frame 0 . Receiver comes to know that the ACK 1 is
lost so it discard the Frame 0 as it receives twice and send the
ACK 1 again

•To detect corrupted frames, we need to add a CRC to each


11.10
data frame.
Figure 23.22: Flow diagram for Example 3.4

23.11
Sliding window

In Stop and Wait at a time only one frame is sent , the next frame will only be sent when
the acknowledgement of the previous send frame arrives.

Sliding window improves the efficiency by allowing the multiple frame to be sent at a
time while the sender is waiting for the acknowledgement.The Maximun No of frames
that can be sent is given by 2 K -1. where k bits are used to represent the Sequence No.
As the sequence number occupies a field in the frame and it should begin with zero.
for example : If k =3 bits are used to represent the sequence number field .
then Maximum number of frames that can be sent is 2 3 - 1 = 7 wihout
Acknowledgement.
Frames should be numbered from 0 1 2 3 4 5 6 0 12 3 4 5 6
A window is maintained both at the sender side and the receiver side .
Window defines the sequence number of frames that are sent but not acknowledged.
The size of the sender window is atmost 2 ^k - 1.
The size of the receiver window is 1.
Buffers are provided at both the sides equal to the window size.

At the sender side


When the sender sends the frame , window size shrinks.
When the acknowledgement arrives ,window size increases.
At the Receiver Side
On receiving the Frame window moves to the next sequence number that it expects to
receive.
11.12
11.13
11.14
11.15
•Go back N works on the concept of the sliding window

•In Go Back N the size of the sliding window is always be less than 2^k

•The size of the Receiving window is always 1.

•If the receiver detects an error in the frame or it receives the Frame out of
order it sends the NAK (Negative Acknowledgement for that Frame)

•The receiver will discard the Frame in error and all the Future Frames until
the frame in error is correctly received.

•The Sender on receiving the NAK acknowledgement must retransmit the


Frame in error plus all the succeeding frames

11.16
For example
•Suppose the Sender sends Frame 0,1,2,3,4,5 towards receiver .Receiver
successfully receives the frame 0,1,2 but it detects an error in Frame 3 so it
sends Negative Acknowledgement for Frame 3 ie.NAK 3 and discard it.

•Mean while Receiver receives Frame 4 and Frame 5 successfully but still it
discards them because it is provided with the buffer size 1 and it is waiting for
the Frame 3 to be send by the sender.

•Sender on receiving NAK 3 not only sends Frame 3 ,but also it sends Frame 4
and Frame 5 again.

•GO BACK N means for the Sender means GO BACK To Frame Number 3 and
resend Frame 3 and all the successive Frames(Frame 4 and Frame 5) to
Receiver a

11.17
Figure 23.23: Go-Back-N protocol

23.18
Figure 23.28: Send window size for Go-Back-N

23.19
Consider the case k = 2 so 2^2 = 4
a)If the send window size <2^k then send window size is taken to be 3
Containing the frames 0 1 2 in window . Now sender send the frames
one by one to the receiver and the receiver on receiving the frames
sends the ACK 1 ,ACK 2 and ACK 3 but all the three
acknowledgements gets Lost . The timer running at the sender also
expires ,sender assumes that all the three frames are lost so it resends
the frame 0,1,2 but the receiver is expecting for the Frame 3 , so as
frame 0,1,2 reaches to the receiver ,receiver knows that these are the
duplicate frames so it discards it and also comes to know that all the
three ACK sent by receiver has not reached so it eventually sent ACK3.

b) If the send window size is = 2^k then the window at the sender
contains frames with sequence no 0 1 2 3 .Sender send all the frames
0123 towards receiver and receiver send the respective
acknowledgement ACK 1ACK2ACK 3 ACK0 to the sender but all are
lost. On the sender side the timer expires ,Sender assumes that all its
frames are lost so it sends the Frame 0 1 2 3but on the other hand the
receiver is expecting new Frame 0 but actually it is receiving the
duplicate frames 0 1 23 so unable to detect and it simply accept
and regard them as the new frames .This results in the ERROR .

11.20
11.21
Example 23.7
Figure 23.29 shows an example of Go-Back-N . This is
an example of a case where the forward channel is
reliable, but the reverse is not. No data packets are lost,
but some ACKs are delayed and one is lost. The
example also shows how cumulative
acknowledgments can help if acknowledgments are
delayed or lost.

23.22
Figure 23.29: Flow diagram for Example 3.7

23.23
Example 23.8
Figure 23.30 shows what happens when a packet is
lost. Packets 0, 1, 2, and 3 are sent. However, packet 1
is lost. The receiver receives packets 2 and 3, but they
are discarded because they are received out of order
(packet 1 is expected). When the receiver receives
packets 2 and 3, it sends ACK1 to show that it expects
to receive packet 23. However, these ACKs are not
useful for the sender because the ackNo is equal Sf to ,
not greaterSfthat . So the sender discards them. When
the time-out occurs, the sender resends packets 1, 2,
and 3, which are acknowledged.

23.24
Figure 23.30: Flow diagram for Example 3.8

23.25
23.2.4 Selective-Repeat Protocol

Selective Repeat also use the concept of the sliding window.

•In Selective Repeat the Sender window size is 2^(k-1).

•Receiver Window Size is also 2^(k-1).

•In Selective Repeat the size of the sender window and the size of
the receiving window is same

In Selective Repeat only those frames are retransmitted for which the NAK
has been received without discarding the successive frames as receiver is
provided with enough buffer capacity to with hold the out of order frames.

23.26
Taking the example of GO BACK N the receiver detects an error in Frame 3
so it discards and sends NAK 3 towards the sender and meanwhile it
receives frame 4 and frame 5 successfully but it also discards frame 4 and
frame 5 .

But Selective Repeat protocol accepts Frame 4 and Frame 5 and keep
them in the Buffer.

Sender on receiving NAK 3 simply sends Frame 3 only not Frame 4 and
Frame 5 again because they are already received successfully by the
receiver.

Band width utilization of the link is more effective in Selective Repeat in


comparison to GO BACK N.

11.27
Figure 23.31: Outline of Selective-Repeat

23.28
Figure 23.32: Send window for Selective-Repeat protocol

23.29
Figure 23.33: Receive window for Selective-Repeat protocol

23.30
Figure 23.35: Flow diagram for Example 3.10

23.31

You might also like