ch11_data_linkcontrol_abir
ch11_data_linkcontrol_abir
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11-1 FRAMING
11.2
11-2 FLOW AND 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
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
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
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
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
11.21
Stop-and-wait ARQ Protocol
Note
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
number to be used
n Only two numbers are used: 0, 1
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
11.29
Stop-and-wait operation
sender receiver
Solution
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
Increase utilization
by a factor of 3!
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
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
out-of-order pkt:
discard (don’t buffer) -> no receiver buffering!
Re-ACK pkt with highest in-order seq #
11.40
Note
11.41
Algorithm 11.7 Go-Back-N sender algorithm
(continued)
11.42
Algorithm 11.7 Go-Back-N sender algorithm (continued)
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
StopTimer
StartTimer
11.46
Example 11.7
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
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
11.52
Figure 11.23 Flow diagram for Example 11.8
11.53
Thank You
11.54