DLL
DLL
11.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11-1 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
11.5
Figure 11.3 A frame in a bit-oriented protocol
11.6
Note
11.7
Figure 11.4 Bit stuffing and unstuffing
11.8
11-2 FLOW AND ERROR CONTROL
11.9
Note
11.10
Note
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)
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
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
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."
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.
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.
11.30
Figure 11.9 Flow diagram for Example 11.2
11.31
Key Benefits of Stop-and-Wait Protocol
Efficiency: The sender can only send one frame at a time, which may be
inefficient in high-speed communication scenarios.
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
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
11.43
Stop-And-Wait ARQ Protocol
11.45
b) The original frame is lost
Example 11.3
11.51
Note
11.52
Note
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
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
Increase utilization
by a factor of 3!
Solution
11.65
Example 11.4
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
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
11.75
Note
11.76
Figure 11.12 Send window for Go-Back-N ARQ
11.77
Note
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
11.82
Note
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
11.86
Algorithm 11.7 Go-Back-N sender algorithm
(continued)
11.87
Algorithm 11.7 Go-Back-N sender algorithm (continued)
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
StopTimer
StartTimer
11.91
Example 11.7
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
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
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)
11.101 (continued)
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)
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