Lecture#1_Data Link Control
Lecture#1_Data Link Control
Lecture 1: Chapter 11
Data Link Control
Sumaya Kazary
Assistant Professor
Department of Computer Science and
Engineering
Dhaka University of Engineering & Technology,
Gazipur
Acknowledgement
Thanks to the authors of all the books and online tutorials used in
this slide.
Framing
2
This study deals with the algorithms for achieving
reliable &efficient communication.
3
4
11-1 FRAMING
5
11-1 FRAMING
6
7
8
9
10
Note
11
Example : Byte stuffing
12
Figure 11.2 Byte stuffing and unstuffing
Sx
Rx
13
(0x7E)
15
Figure 11.4 Bit stuffing and unstuffing
Sx
Rx
16
11-2 FLOW AND ERROR CONTROL
17
18
19
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.
The protocols are normally implemented in
software by using one of the common programming
languages.
To make our discussions language-free, we have
written in pseudocode a version of each protocol that
concentrates mostly on the procedure instead of
delving into the details of language rules.
11.20
Figure 11.5 Taxonomy of protocols discussed in this chapter
Sliding
Window
Protocols
11.21
11-4 NOISELESS CHANNELS
11.22
23
Figure 11.6 The design of the simplest protocol with no flow or error control
11.24
Algorithm 11.1 Sender-site algorithm for the simplest protocol
11.25
26
2.
27
Stop-and-wait Protocol
Sender Receiver
Frame
Acknowledgement
Frame
Acknowledgement
Frame
Acknowledgement
28
Problems of Stop-and-wait Protocol
1. Problems Due to lost data !!!
Sender waits for ack for an infinite amount of time.
Receiver waits for data an infinite amount of time.
Sender Receiver
Frame
29
Problems of Stop-and-wait Protocol
2. Problems due to lost Acknowledgement !!!
Sender waits for an infinite amount of time for ack.
Sender Receiver
Data
Acknowledgement
30
Problems of Stop-and-wait Protocol
3. Problems due to delayed Ack/data !!!
After timeout on sender side, a delayed ack might
be wrongly considered as ack of some other data
packet.
Sender Receiver
Data
Acknowledgement
31
Figure 11.8 Design of Stop-and-Wait Protocol
11.32
33
11-5 NOISY CHANNELS
11.34
1. Stop-and-Wait ARQ Overview
Sender waits “reasonable” amount of time for
ACK
Thus Sender needs a countdown timer
timeout period
If Frame (or ACK) just delayed (not lost):
retransmission will create duplicate packet
Frame 0
Timer Starts
Acknowledgement 1
Frame 1
37
Stop-and-wait ARQ Protocol
Scenario 2:The original frame is lost
Sender Receiver
Frame 0
Timeout
Frame 0
Timer Acknowledgement 1
38
Stop-and-wait ARQ Protocol
Scenario 3:The Ack is lost
Sender Receiver
Frame 0
Timeout
Ack 1
Frame 0
Timer Ack 1
39
Stop-and-wait ARQ Protocol
Scenario 4:The timeout fires too soon
Sender Receiver
Frame 0
Timeout
Ack 1
Ack 1
Frame 0
Timer
Ack 1
40
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol
11.41
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.42
Stop-and-wait operation
sender receiver
first packet bit
transmitted, t = 0
11.44
45
46
47
Go-Back-N ARQ Protocol
N in the Go-Back-N stands for sender’s window
size.
For example, if the sending window size is 4(2 2), then the
sequence numbers will be 0,1, 2, 3, 0, 1, 2, 3, 0, 1, 0 & so on.
The number of bits in the sequence number is 2 to generate
the binary sequence 00, 01, 10, 11.
The number of the frames that can be sent depends on
the WINDOW SIZE of the SENDER
If the ACK of a frame is not received within an agreed
upon time period, all the frames in the current window are
Re-transmitted.
48
Go-Back-N ARQ Protocol
Sliding
Window
1 0 3 2 1 0 3 2 1 0 Receiver
Sender
0
Window 4 1
ACK1
Size 2
3 ACK2
ACK3
Discarded
0
1
Retransmitted frames 2
in the window which 3
has not been 0
Acknowledged 1
49
50
51
Cumulative ACK
ACK(n): ACKs of all frames up to and include sequence #(n-1)
have been received, may receive duplicate ACKs (see receiver
window)
A single timer for the oldest transmitted but UNACK frames
Timeout: retransmit all frames in window (up to N frame)
52
53
Out-of-order frame:
discard (don’t buffer) -> no receiver buffering!
Re-ACK frame with highest in-order seq #
54
Example 11.6
Figure 11.16 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 frames
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.
Stop Timer
Start Timer
Stop Timer
Start Timer
Figure 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
57
Selective Repeat ARQ
Problem with Go-back-N:
Sender: resend many packets with a single lose
Receiver: discard many good received (out-of-order)
packets
Very inefficient when N becomes bigger (in high-speed
network)
Solution: Receiver individually acknowledges all
correctly received pkts
buffers pkts, as needed, for eventual in-order delivery to
upper layer
sender only resends pkts for which ACK not
received
sender keeps timer for each unACKed pkt
sender window
N consecutive seq #’s
again limits seq #s of sent, unACKed pkts
59
60
Figure 11.18 Send window for Selective Repeat ARQ
11.61
62
Figure 11.19 Receive window for Selective Repeat ARQ
63
Selective Repeat ARQ Protocol (Considering 3-bit Seq #)
Sender Receiver
Sliding
Window 0
1 0 7 6 5 4 3 2 1 0 1 ACK1
2
ACK2
3
4
Window 4 Suppose, Frame #2 is
Size Lost/Corrupted NAK2
5
Retransmit only 2
the LOST frame in
the sent window ACK6
which has not
been
Acknowledged 6
7
0
1
64
Example 11.8
This example is similar to Example 11.3 in which frame 1 is lost. We show
how Selective Repeat behaves in this case. The following shows the
situation.
Figure 11.23
66
67
Q&A