0% found this document useful (0 votes)
8 views106 pages

DLL

Chapter 11 discusses Data Link Control, focusing on framing, flow control, and error control mechanisms in data transmission. It introduces protocols like Stop-and-Wait ARQ and Go-Back-N ARQ, detailing their operations and limitations, particularly in handling noisy channels. The chapter emphasizes the importance of sequence numbers and acknowledgments in ensuring reliable data transfer between sender and receiver.

Uploaded by

vijaya.yukthesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views106 pages

DLL

Chapter 11 discusses Data Link Control, focusing on framing, flow control, and error control mechanisms in data transmission. It introduces protocols like Stop-and-Wait ARQ and Go-Back-N ARQ, detailing their operations and limitations, particularly in handling noisy channels. The chapter emphasizes the importance of sequence numbers and acknowledgments in ensuring reliable data transfer between sender and receiver.

Uploaded by

vijaya.yukthesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

Chapter 11

Data Link Control

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
Figure 11.1 A frame in a character-oriented protocol

11.3
Figure 11.2 Byte stuffing and unstuffing

11.4
Note

Byte stuffing is the process of adding 1


extra byte whenever there is a flag or
escape character in the text.

11.5
Figure 11.3 A frame in a bit-oriented protocol

11.6
Note

Bit stuffing is the process of adding one


extra 0 if 011111 is encountered in data,
so that the receiver does not mistake
the pattern 0111110 for a flag.

11.7
Figure 11.4 Bit stuffing and unstuffing

11.8
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.9
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.

Aka: Don’t overwhelm the receiver!

11.10
Note

Error control in the data link layer is


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

11.11
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.12
Figure 11.5 Taxonomy of protocols discussed in this chapter

11.13
Finite state machine (FSM)

The behavior of a data-link-layer protocol can be better shown as a


finite state machine (FSM).

An FSM is thought of as a machine with a finite number of states.

The machine is always in one of the states until an event occurs.

Each event is associated with two reactions: defining the list (possibly
empty) of actions to be performed and determining the next state
Finite state machine
11-4 NOISELESS CHANNELS

Let us first assume we have an ideal channel in which


no frames are:
1. lost,
2. duplicated, or corrupted.

Topics discussed in this section:


Simplest Protocol
Stop-and-Wait Protocol

11.16
FSM for simple protocol
Figure 11.6 The design of the simplest protocol with no flow or error control

11.18
Sender Side Algorithm Breakdown

The sender enters an infinite loop, where it will continuously check for
events to trigger its actions.

If a request to send data occurs, the sender retrieves the data, frames
it, and sends it out.

Once the data is sent, the sender goes back into the waiting state,
essentially sleeping until something else happens (like a new request
or a timeout).
Algorithm 11.1 Sender-site algorithm for the simplest protocol

11.20
Algorithm 11.2 Receiver-site algorithm for the simplest protocol

1. No flow and error control


2. Unidirectional

11.21
Figure 11.7 Flow diagram for Example 11.1

11.22
Need of Next Protocol

"When data frames arrive faster than the receiver can process, they
must be stored temporarily, but limited storage may cause frame
discarding or denial of service."

"To prevent overwhelming the receiver, feedback from the receiver to


the sender is necessary, telling the sender to slow down."

"The Stop-and-Wait Protocol ensures the sender sends one frame at a


time, waiting for acknowledgment before sending the next, adding flow
control to manage data flow."
Stop-and-Wait Protocol Design

Receiver: The device or


Sender: The device or entity that processes the
Key Concepts: entity that initiates the data and sends back
data transfer. acknowledgments
(ACK).

ACK Frame: An
Data Frame: A packet of acknowledgment frame
data sent from the sent by the receiver to
sender to the receiver. confirm receipt of a data
frame.
Workflow (Sender and Receiver Interaction):

Sender Actions:

Send a Data Frame: The sender sends one frame of data to the receiver.

Wait for ACK: After sending the data frame, the sender waits for an
acknowledgment (ACK) from the receiver.
Send Next Frame: Once the ACK is received, the sender sends the next data
frame.
Repeat: The sender continues this process until all data frames are sent.
Workflow (Sender and Receiver Interaction):

Receiver Actions:

Receive Data Frame: The receiver receives the data frame sent by the sender.

Process Data: The receiver processes the received frame.

Send ACK: After processing the data frame, the receiver sends an
acknowledgment (ACK) to the sender to confirm successful receipt.
Wait for Next Frame: The receiver waits for the next data frame from the
sender.
FSM for stop
and wait
Figure 11.8 Design of Stop-and-Wait Protocol

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

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

• At any time, there is either one data frame on the forward channel or
one ACK frame on the reverse channel.

• We therefore need a half-duplex link.

11.30
Figure 11.9 Flow diagram for Example 11.2

o Sending two frames in the


protocol involves the sender
in four events and the
receiver in two events

11.31
Key Benefits of Stop-and-Wait Protocol

Simple and Reliable: The sender waits for confirmation


before sending more data.

Flow Control: Prevents receiver overload by sending


one frame at a time.

Error Detection: If the receiver doesn’t receive the


frame correctly, it doesn’t send the ACK, prompting
the sender to resend the frame.
Limitations

Efficiency: The sender can only send one frame at a time, which may be
inefficient in high-speed communication scenarios.

Time Delays: Waiting for an acknowledgment before sending the next


frame can introduce delays, especially in long-distance communication.
NOISY CHANNELS

Stop-and-Wait Protocol: Adds flow control to prevent


overwhelming the receiver.

Limitation: Assumes a noiseless channel, which is unrealistic in


real-world communication.

Real-World Issue: No communication channel is completely free


from errors (noise can affect data).

Error Control: To handle errors, error control mechanisms need


to be added to the protocol.

Protocols for Error Control: The section discusses three


protocols that integrate error control to handle noisy channels.
11-5 NOISY CHANNELS

Topics discussed in this section:


Stop-and-Wait Automatic Repeat Request (ARQ)
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request

11.35
Solution: Add Timeout
Solution: TO + Add Sequence no for data
Solution: TO + Seq. no for data + Add Seq. for ack
Stop and wait

One frame at time. After sending, sender waits for ACK


signal and doesn't send any further frames until it is
received.
• If the received frame is damaged or lost, the receiver
discards it and does not send an ACK. If a certain time,
known as the timeout, passes without ACK, the sender
sends the frame again.
• Problem 1 - is where the ACK sent by the receiver is
damaged or lost. In this case, the sender doesn't receive the
ACK, times out, and sends the frame again. Now the
receiver has two copies of the same frame, and doesn't
know if the second one is a duplicate frame or the next
frame of the sequence carrying identical data.

11.41
Stop and wait

• Problem 2 - is when the sender's timeout runs out before the frame
reaches the receiver. In this case the sender resends the same
packet. Eventually the receiver gets two copies of the same frame,
and sends an ACK for each one. The sender, waiting for a single ACK,
receives two ACKs, which may cause problems if it assumes that the
second ACK is for the next frame in the sequence.

11.42
Stop and wait

• To avoid these problems, the most common solution is to


define a 1 bit sequence number which is attached to the
header of the frame. This sequence number alternates (from
0 to 1) in subsequent frames. When the receiver sends an
ACK, it attaches the sequence number of the next packet it
expects. This way, the receiver can detect duplicated frames
by checking if the frame sequence numbers alternate. If two
subsequent frames have the same sequence number, they
are duplicates, and the second frame is discarded. Similarly,
if two subsequent ACKs have the same sequence number,
they are acknowledging the same frame.

11.43
Stop-And-Wait ARQ Protocol

 Idea of stop-and-wait ARQ protocol is straightforward.


 After transmitting one frame the sender waits for an
acknowledgement before transmitting the next frame.
 If the acknowledgement does not arrive after a certain
period the sender times out and retransmits the original
frame.
Stop-and-Wait ARQ = Stop-and-wait + Timeout Timer + Seq. No.

11.45
b) The original frame is lost
Example 11.3

Figure 11.11 shows an example of Stop-and-Wait ARQ.


Frame 0 is sent and acknowledged. Frame 1 is lost and
resent after the time-out. The resent frame 1 is
acknowledged and the timer stops. Frame 0 is sent and
acknowledged, but the acknowledgment is lost. The
sender has no idea if the frame or the acknowledgment
is lost, so after the time-out, it resends frame 0, which is
acknowledged.

11.51
Note

In Stop-and-Wait ARQ, we use sequence


numbers to number the frames.
The sequence numbers are based on
modulo-2 arithmetic.

11.52
Note

In Stop-and-Wait ARQ, the


acknowledgment number always
announces in modulo-2 arithmetic the
sequence number of the next frame
expected.

11.53
Figure 11.11 Flow diagram for Example 11.3

11.54
FSM for stop and wait ARQ
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol

11.56
Algorithm 11.5 Sender-site algorithm for Stop-and-Wait ARQ

(continued)

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

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

Rn is the sequence number of


the next packet expected
11.59
Utilization of 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?
Utilization = L/R / (RTT+L/R)
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.61
 In networking and in other areas, a task is
often begun before the previous task has
ended. This is known as pipelining.

11.63
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)


3-
Transport Layer
64
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

11.65
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. What is the bandwidth-delay product?
If the system data frames are 1000 bits in length, what is
the utilization percentage of the link?

Solution
The bandwidth-delay product is

11.66
Example 11.4 (continued)

The system can send 20,000 bits during the time it takes
for the data to go from the sender to the receiver and then
back again. However, the system sends only 1000 bits. We
can say that the link utilization is only 1000/20,000, or 5
percent. 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.67
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 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.68
11.69
11.71
11.72
Go-Back-N ARQ
 The key to Go-back-N is that we can send several
packets before receiving acknowledgments, but
 The receiver can only buffer one packet.
 We keep a copy of the sent packets until the acks arrive.

Seq no N/L

D/L

11.74
Go-Back-N ARQ Protocol

 Go-Back-N-ARQ uses the concept of protocol pipelining i.e.,


sender can send multiple frames before receiving the ack for
the first frame.
 There are finite no of frames, and the frames are numbered in a
seq. manner.
 The no of frames that can be sent depends on the window size of
sender.
 If the ack is not received within an agreed upon time period, all
frames in the current window are transmitted.
 The size of sending window determines the sequence no of the
outstanding frames.

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

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

11.77
Note

The send window is an abstract concept


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

11.78
Sliding the send window

Note

11.79
Note

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

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

11.82
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.83
Figure 11.14 Design of Go-Back-N ARQ

11.84
Figure 11.15 Window size for Go-Back-N ARQ

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

11.86
Algorithm 11.7 Go-Back-N sender algorithm

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

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


StopTimer();
Else
{ StartTimer();

Typo in Textbook!

11.88
Algorithm 11.8 Go-Back-N receiver algorithm

11.89
Figure 11.16 Flow diagram for Example 11.6
Typo in Textbook!

StopTimer

StartTimer

Cumulative acknowledgments can help if acknowledgments are delayed or lost


11.90
Figure 11.17 Flow diagram for Example 11.7

StopTimer

StartTimer

11.91
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.92
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.93
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.94
Figure 11.18 Send window for Selective Repeat ARQ

11.95
Figure 11.19 Receive window for Selective Repeat ARQ

11.96
Figure 11.20 Design of Selective Repeat ARQ

11.97
Figure 11.21 Selective Repeat ARQ, window size

11.98
Note

In Selective Repeat ARQ, the size of the


sender and receiver window
must be at most one-half of 2m.

11.99
Algorithm 11.9 Sender-site Selective Repeat algorithm

(continued)
There are m timers for a window size of m
11.100
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)

Still use Cumulative ACK

11.101 (continued)
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)

Only need to retransmit time-outed frame

11.102
Algorithm 11.10 Receiver-site Selective Repeat algorithm

11.103
Algorithm 11.10 Receiver-site Selective Repeat algorithm

11.104
Figure 11.23 Flow diagram for Example 11.8

11.105
Figure 11.24 Design of piggybacking in Go-Back-N ARQ

11.106

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy