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

ch11_data_linkcontrol_abir

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

ch11_data_linkcontrol_abir

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

Chapter 11

Data Link Control


Partially Edited and
Presented by
Dr. Md. Abir Hossain

11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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.
Topics discussed in this section:
Fixed-Size Framing
Variable-Size Framing

11.2
11-2 FLOW AND ERROR CONTROL

The most important responsibilities of the data link


layer are flow control and error control. Collectively,
these functions are known as data link control.

Topics discussed in this section:


Flow Control
Error Control

11.3
Flow Control
Ø Flow control is a set of procedures that tells the sender
how much data it can transmit before it must wait for an
acknowledgment from the receiver.
Ø Any receiving device has a limited speed at which it can
process incoming data and a limited amount of memory
in which to store incoming data.
Ø Incoming data must be checked and processed before
they can be used. The rate of such processing is often
slower than the rate of transmission.
Ø For this reason, each receiving device has a block of
memory, called a buffer, reserved for storing incoming
data until they are processed.
Ø If the buffer begins to fill up, the receiver must be able to
tell the sender to halt transmission until it is once again
able to receive.
11.4
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.

11.5
Error Control
Ø Error control is both error detection and error correction.
Ø It allows the receiver to inform the sender of any frames
lost or damaged in transmission and coordinates the
retransmission of those frames by the sender.
Ø In Data link layer, the term error control refers primarily
to methods of error detection and retransmission.
Ø In data link layer error control is simply: Any time an
error is detected in an exchange, specified frames are
retransmitted.

11.6
Note

Error control in the data link layer is


based on automatic repeat request,
which is the retransmission of data.

11.7
11-3 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.

11.8
Figure 11.5 Taxonomy of protocols discussed in this chapter

11.9
11-4 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

11.10
Simplest Protocol
Ø Simplest Protocol has no flow or error control.
Ø It is a unidirectional protocol in which data frames are
traveling in only one direction-from the sender to
receiver.
Ø The sender site cannot send a frame until its network
layer has a data packet to send.
Ø The data link layer at the sender site gets data from its
network layer, makes a frame out of the data, and
sends it.
Ø Similarly, The receiver site cannot deliver a data packet
to its network layer until a frame arrives.
Ø The data link layer at the receiver site receives a frame
from its physical layer, extracts data from the frame, and
11.11 delivers the data to its network layer.
Figure 11.6 The design of the simplest protocol with no flow or error control

11.12
Algorithm 11.1 Sender-site algorithm for the simplest protocol

11.13
Algorithm 11.2 Receiver-site algorithm for the simplest protocol

11.14
Figure 11.7 Flow diagram for Example 11.1

Ø The flow activity is very simple. The sender sends a


sequence of frames without thinking about the receiver.
Ø To send three frames, three events occur at the sender site
and three events at the receiver site.

11.15
Stop-and-wait Protocol
Ø In stop-and-wait protocol, sender sends one frame ,
stops until it receives confirmation from the receiver and
then sends next frame.
Ø The stop-and-wait also provide unidirectional
communication for data frames, but auxiliary ACK
frames travel from the other direction.
Ø At any time, there is either one data frame on the
forward channel or one ACK frame on the reverse
channel.
Ø Here two events can occur: a request from network
layer or an arrival notification from the physical layer.
Ø After a frame is sent, the algorithm must ignore another
network layer request until that frame is acknowledged.
11.16
Figure 11.8 Design of Stop-and-Wait Protocol

11.17
Algorithm 11.3 Sender-site algorithm for Stop-and-Wait Protocol

11.18
Algorithm 11.4 Receiver-site algorithm for Stop-and-Wait Protocol

11.19
Figure 11.9 Flow diagram for Example 11.2

Ø The flow activity is quite simple and similar with simplest protocol
with one exception.
Ø After the data frame arrives, the receiver sends an ACK frame to
acknowledge the receipt and allow the sender to send the next
frame.
Ø The sender sends one frame and waits for feedback from the
receiver.
Ø When the ACK arrives, the sender sends the next frame.
11.20
11-5 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 (ARQ)
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request

11.21
Stop-and-wait ARQ Protocol

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.

11.22
Stop-and-wait ARQ Protocol
Ø The stop-and-wait Automatic Repeat reQuest (stop-and-wait ARQ),
protocol adds a simple error control mechanism to the stop-and-
wait protocol.
Ø The received frame could be the correct one, a duplicated, or
corrupted , or a frame out of order.
Ø The corrupted and lost frames need to be resent in this protocol.
Ø If the receiver does not respond when there is an error, how can
the sender know which frame to resend?
Ø To solve this problem, the sender keeps a copy of the sent frame.
At the same time, it starts a timer.
Ø If the timer expires and there is no ACK for the sent frame, the
frame is resent, the copy is held, and the timer is restarted.
Ø Since the protocol uses the stop-and-wait mechanism, there is only
one specific frame that needs an ACK even though several copies
of the same frame can be in the network.
11.23
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol

11.24
Stop-and-Wait ARQ Overview

n Sender waits “reasonable” amount of time for ACK


n Thus Sender needs a countdown timer
n Start the timer when a packet is sent

n retransmits if no ACK received within the timeout period

n if pkt (or ACK) just delayed (not lost):


n retransmission will create duplicate packet

n Thus it requires packet sequence number and ack

number to be used
n Only two numbers are used: 0, 1

n Receiver’s Ack number is what he is expected next


n After receiving Pkt 0, sends back ACK 1
n After receiving Pkt 1, sends back ACK 0

Transport Layer
3-25
Algorithm 11.5 Sender-site algorithm for Stop-and-Wait ARQ

Modulo-2 addition

(continued)

11.26
Algorithm 11.5 Sender-site algorithm for Stop-and-Wait ARQ (continued)

11.27
Algorithm 11.6 Receiver-site algorithm for Stop-and-Wait ARQ Protocol

Modulo-2 addition

Rn is the sequence number of


the next packet expected
11.28
Figure 11.11 Flow diagram for Example 11.3

11.29
Stop-and-wait operation
sender receiver

first packet bit


transmitted, t = 0
first packet bit arrives
RTT last packet bit arrives, send
ACK

ACK arrives, send next


packet, t = RTT + L / R

L: packet bit length


R: link bandwidth (bps)

Utilization = L/R / (RTT+L/R)


Example 11.4

Assume that, in a Stop-and-Wait ARQ system, the


bandwidth of the line is 1 Mbps, and 1 bit takes 20 ms to
make a round trip. If the system data frames are 1000 bits
in length, what is the utilization percentage of the link?

Solution

L = 1000 bits, R = 1Mbps, RTT = 20ms


Utilization = 1/ 21 = 4.8%

For this reason, for a link with a high bandwidth or long delay, the use of Stop-
and-Wait ARQ wastes the capacity of the link.

11.31
Pipelining: increased utilization

sender receiver

first packet bit transmitted, t = 0


last bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK
nd
last bit of 2 packet arrives, send ACK
rd
last bit of 3 packet arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R

Increase utilization
by a factor of 3!

Utilization = 3*L/R / (RTT+L/R)


Transport Layer
3-32
Example 11.5

What is the utilization percentage of the link in


Example 11.4 if we have a protocol that can send up to
15 frames before stopping and worrying about the
acknowledgments?

Solution:
The bandwidth-delay product(R*RTT) is still 20,000 bits.
The system can send up to 15 frames or 15,000 bits
during a round trip. This means the utilization is
15,000/20,000, or 75 percent. Of course, if there are
damaged frames, the utilization percentage is much less
because frames have to be resent.
11.33
Pipelined protocols

Pipelining: sender allows multiple, “in-flight”, yet-to-


be-acknowledged pkts
n range of sequence numbers must be increased
n buffering at sender and/or receiver

n Two generic forms of pipelined protocols:


n go-Back-N, selective repeat Transport Layer
3-34
Go-Back-N ARQ Protocol
Ø The key concept of the Go-back-N(GBN) ARQ is to send
several packets before receiving acknowledgments.
Ø The sender keep a copy of the sent packets until the
acknowledgments arrive.
Ø The receiver can only buffer one packet at a time.
Ø In the Go-Back-N ARQ Protocol, the sequence numbers are
modulo 2m ,range from 0 to 2m - 1, where m is the size of the
sequence number field in bits.
Ø For example, if m is 4, the only sequence numbers are 0
through 15 inclusive.
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,...

11.35
Figure 11.14 Design of Go-Back-N ARQ

11.36
Figure 11.12 Send window for Go-Back-N ARQ

11.37
Note
The send window is an abstract concept defining an
imaginary box of size 2m − 1 with three variables: Sf,
Sn, and Ssize.
The send window can slide one
or more slots when a valid acknowledgment arrives.

Cumulative ACK
r ACK(n): ACKs all pkts up to and include seq # n-1 have been
received may receive duplicate ACKs (see receiver)
r A single timer for the oldest transmitted but un-acked pkt
r timeout: retransmit all pkts in window (up to N packets)

11.38
Figure 11.13 Receive window for Go-Back-N ARQ

11.39
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.

out-of-order pkt:
discard (don’t buffer) -> no receiver buffering!
Re-ACK pkt with highest in-order seq #

11.40
Note

Stop-and-Wait ARQ is a special case of


Go-Back-N ARQ in which the size of the
send window is 1.

11.41
Algorithm 11.7 Go-Back-N sender algorithm

(continued)
11.42
Algorithm 11.7 Go-Back-N sender algorithm (continued)

If (Sf ==Sn ) // the window is empty


StopTimer();
Else
{ StartTimer();

Typo in Textbook!

11.43
Algorithm 11.8 Go-Back-N receiver algorithm

11.44
Figure 11.16 Flow diagram for Example 11.6

StopTimer

StartTimer

Cumulative acknowledgments can help if acknowledgments are delayed or lost


11.45
Figure 11.17 Flow diagram for Example 11.7

StopTimer

StartTimer

11.46
Example 11.7

Figure 11.17 shows what happens when a frame is lost. Frames 0,


1, 2, and 3 are sent. However, frame 1 is lost. The receiver receives
frames 2 and 3, but they are discarded because they are received
out of order. The sender receives no acknowledgment about frames
1, 2, or 3. Its timer finally expires. The sender sends all outstanding
frames (1, 2, and 3) because it does not know what is wrong. Note
that the resending of frames 1, 2, and 3 is the response to one
single event. When the sender is responding to this event, it cannot
accept the triggering of other events. This means that when ACK 2
arrives, the sender is still busy with sending frame 3.

11.47
Example 11.7 (continued)

The physical layer must wait until this event is completed and the
data link layer goes back to its sleeping state. We have shown a
vertical line to indicate the delay. It is the same story with ACK 3;
but when ACK 3 arrives, the sender is busy responding to ACK 2. It
happens again when ACK 4 arrives. Note that before the second
timer expires, all outstanding frames have been sent and the timer
is stopped.

11.48
Example 11.17 shows that because of one packet lost, all following
packets will need to be retransmitted, even if they have arrived at
the destination à A great waste of bandwidth

Better protocol: selective repeat ARQ

11.49
Selective Repeat ARQ
n Problem with Go-back-N:
n Sender: resend many packets with a single lose
n Receiver: discard many good received (out-of-order) packets
n Very inefficient when N becomes bigger (in high-speed network)
n Solution: Receiver individually acknowledges all correctly
received pkts
n buffers pkts, as needed, for eventual in-order delivery to upper
layer
n sender only resends pkts for which ACK not received
n sender keeps timer for each unACKed pkt
n sender window
n N consecutive seq #’s
n again limits seq #s of sent, unACKed pkts
Figure 11.20 Design of Selective Repeat ARQ

11.51
Figure 11.18 Send window for Selective Repeat ARQ

Figure 11.19 Receive window for Selective Repeat ARQ

11.52
Figure 11.23 Flow diagram for Example 11.8

11.53
Thank You

11.54

You might also like