Communication Networks Lecture 09 - Flow Control, Error Control (Read-Only)
Communication Networks Lecture 09 - Flow Control, Error Control (Read-Only)
Communication Networks
Dr. G. Balamurugan
Assistant Professor
Department of Electronics Engineering
MIT Campus, Anna University.
Dr. G. Balamurugan
1
Department of Electronics Engineering, MIT Campus
UNIT II DATA LINK LAYER AND NETWORK
INTERCONNECTION
Logical link control Functions:- Framing, Flow control , Error
control: CRC, LLC protocols:- HDLC, P to P. Medium access
layer:- Random access, Controlled access, Channelization,
IEEE standards:- 802.3, 802.4 and 802.5. Internetworking,
Interconnection issues, Interconnection devices:- Repeaters,
Hubs, Routers/switches and Gateways.
Dr. G. Balamurugan
2
Department of Electronics Engineering, MIT Campus
Data Link Layer (DLL)
Dr. G. Balamurugan
3
Department of Electronics Engineering, MIT Campus
Data Link Layer
LLC layer for LANs is concerned with
Network Layer the transmission of a link level protocol
data unit (PDU) between two stations,
without the necessity of an intermediate
switching node
Dr. G. Balamurugan
5
Department of Electronics Engineering, MIT Campus
4. Error Control
• Error control includes both error detection and error correction.
• Error control allows the receiver to inform the sender of any frames lost
or damaged in transmission. [Automatic repeat request (ARQ)]
• Error control in the data link layer is based on automatic repeat request
(ARQ). Whenever an error is detected, specified frames are
retransmitted.
Dr. G. Balamurugan
6
Department of Electronics Engineering, MIT Campus
Flow control Protocols
Dr. G. Balamurugan
7
Department of Electronics Engineering, MIT Campus
A1. Simplest Protocol
( Noiseless Channel )
1. Simplest protocol has no Flow control and Error control mechanism.
2. It is unidirectional protocol in which data frames are travelling in only
one direction, from the sender to receiver.
3. Simplest protocol assumes that the processing time of the receiver is
small and negligible.
4. The sender sends a sequence of frames without even thinking about the
receiver.
Dr. G. Balamurugan
8
Department of Electronics Engineering, MIT Campus
Algorithm: Sender-site algorithm for the simplest protocol
Dr. G. Balamurugan
9
Department of Electronics Engineering, MIT Campus
Flow Diagram : Simplest Protocol
Sender Receiver
Request
Arrival
Request
Request Arrival
Request Arrival
Note: Unlimited buffer and
Request Arrival speed for the receiver
Arrival
Time Time
Dr. G. Balamurugan
10
Department of Electronics Engineering, MIT Campus
A2. Stop and wait Protocol
( Noiseless Channel )
Dr. G. Balamurugan
11
Department of Electronics Engineering, MIT Campus
1. Stop and wait Protocol
( Noiseless Channel )
Algorithm : Sender-site algorithm for Stop-and-Wait Protocol
Dr. G. Balamurugan
12
Department of Electronics Engineering, MIT Campus
1. Stop and wait Protocol
( Noiseless Channel )
Dr. G. Balamurugan
13
Department of Electronics Engineering, MIT Campus
Flow Diagram : Stop and wait Protocol
Advantage:
Sender Receiver
Simplicity: Each frame is
checked and ACK before the
Request
next frame is sent.
Arrival
Request Disadvantage:
Arrival Inefficiency:
Slow (half duplex link )
Forward channel : Data
Time Time Reverse channel: ACK
Dr. G. Balamurugan
14
Department of Electronics Engineering, MIT Campus
Flow control Protocols
Error control in the data link layer is based on automatic repeat
request (ARQ), done by keeping a copy of the sent frame and
retransmitting of the frame when the timer expires.
Dr. G. Balamurugan
15
Department of Electronics Engineering, MIT Campus
Noisy Channel
• Noiseless channels are nonexistent
• We need to add error control to our protocols.
• Redundancy bits to data frame.
• In our previous protocols, there was no way to identify a
corrupted frame.
Cases of Operations:
1. Normal operation
Dr. G. Balamurugan
18
Department of Electronics Engineering, MIT Campus
Case 1: Normal operation
Sender Receiver
S=0
R=0
Deliver
Timeout R=1
S=1
Deliver
R=0
Timeout
Time Time
Control variable
S – holds number of the recently sent frame
R – holds number of the expected frame
Dr. G. Balamurugan
19
Department of Electronics Engineering, MIT Campus
Case 2: Lost or damaged frame
Sender Receiver
S=0 R=0
Deliver
S=1 R=1
Timeout
Deliver
R=0
Time Time
Dr. G. Balamurugan
20
Department of Electronics Engineering, MIT Campus
Case 3: Lost ACK frame
Sender Receiver
S=0 R=0
Deliver
S=1 R=1
Deliver
Timeout R=0
S=1
Frame 0 expected;
discard
R=0
S=0
S=0 R=0
Deliver
Timeout R=1
Frame 0 expected;
discard
S=1
R=1
Timeout
Deliver
R=0
S=0
Dr. G. Balamurugan
22
Department of Electronics Engineering, MIT Campus
Stop & Wait ARQ : Algorithm
Algorithm: Receiver-site algorithm for Stop-and-Wait ARQ Protocol
(continued)
Dr. G. Balamurugan
23
Department of Electronics Engineering, MIT Campus
Stop & Wait ARQ : Algorithm
Algorithm: Sender-site algorithm for Stop-and-Wait ARQ (continued)
Dr. G. Balamurugan
24
Department of Electronics Engineering, MIT Campus
Stop & Wait ARQ : Algorithm
Algorithm: Receiver-site algorithm for Stop-and-Wait ARQ Protocol
Dr. G. Balamurugan
25
Department of Electronics Engineering, MIT Campus
Summary : Stop & Wait ARQ
Why data frames need to be numbered?
Dr. G. Balamurugan
26
Department of Electronics Engineering, MIT Campus
Disadvantage of Stop-and-Wait ARQ
• After each frame sent, the host must wait for an ACK
Inefficient use of bandwidth
Dr. G. Balamurugan
27
Department of Electronics Engineering, MIT Campus
Sliding Window
• In the sliding window method of flow control, Sender can transmit
several frames before waiting for an ACK.
• Number of un-ACKed frames is called the window.
Sender Receiver
Window
Dr. G. Balamurugan
29
Department of Electronics Engineering, MIT Campus
Sliding Window
Sliding window of the sender
Tx shrinks from left when frames of
data are sent.
Dr. G. Balamurugan
31
Department of Electronics Engineering, MIT Campus
Sliding Window : Why window size is
(2^m)-1 ?
Timeout
Timeout
Dr. G. Balamurugan
34
Department of Electronics Engineering, MIT Campus
Go-Back-N ARQ
We can send up to W frames before worrying about ACKs.
If a frame is lost, the lost frame and all of the following frames must be
retransmitted
Sequence Numbers:
Frame header contains m bits for sequence number
Dr. G. Balamurugan
35
Department of Electronics Engineering, MIT Campus
Go-Back-N ARQ
• The problem of “Stop and Wait” is not able to send multiple packets
• Sliding Window Protocol allows multiple frames to be in transit
• Receiver has buffer of 1 (called window size) frames
• Transmitter can send up to W frames without ACK
• Each frame is numbered using Sequence number bounded by size of
the sequence number field (k bits)
• Once the first frames in the window is ACKed
Transmitter
– ACKed frames are removed from the buffer
– More frames are transmitted
– Receiver expects one frame at a time
– Result: The window slides to the right
Receiver
Dr. G. Balamurugan
36
Department of Electronics Engineering, MIT Campus
Go-back-N : Control Variables
• S holds the sequence number of recently sent frame
• SF holds the sequence number of the first frame
• SL holds the sequence number of the last frame
• Receiver only has the one variable, R, that holds the sequence number of
the frame it expects to receive. If the seq. no. is the same as the value of
R, the frame is accepted, otherwise rejected.
Dr. G. Balamurugan
37
Department of Electronics Engineering, MIT Campus
Acknowledgement (ACK)
• Receiver sends positive ACK if a frame arrived safe and in order.
• If the frames are damaged/out of order, receiver is silent and discard all subsequent
• The silence of the receiver causes the timer of the unacknowledged frame to expire.
• Then the sender resends all frames, beginning with the one with the expired timer.
• For example, suppose the sender has sent frame 6, but the timer for frame 3 expires
(i.e. frame 3 has not been acknowledged), then the sender goes back and sends
• The receiver does not have to acknowledge each frame received, it can send one
Dr. G. Balamurugan
38
Department of Electronics Engineering, MIT Campus
Case 1. Go-back-N (Normal Operation)
Sender keeps track of
Sender Receiver
the outstanding frames and
updates the variables
andwindows as the ACKs
arrive.
Time Time
Dr. G. Balamurugan
39
Department of Electronics Engineering, MIT Campus
Case 2: Go-Back-N (damaged/lost/delayed)ACK
Sender Receiver
• If an ACK is damaged/lost,
we can have two situations:
(1) If the next ACK arrives
before the expiration of any
timer, there is no need for
retransmission of frames
because ACKs are
cumulative in this protocol.
(2) If ACK1, ACK2, and
ACk3 are lost, ACK4 covers
them if it arrives before the
timer
• expires.
• If ACK4 arrives after time-
out, the last frame and all the
frames after that are resent.
Timeout
• Receiver never resends an
ACK.
• A delayed ACK also triggers
Time Time the resending of frames
Dr. G. Balamurugan
40
Department of Electronics Engineering, MIT Campus
Disadvantage of Go-back-N
Inefficient
all out of order received packets are discarded at receiver
Solution
re-send only the damaged frames
Dr. G. Balamurugan
41
Department of Electronics Engineering, MIT Campus
Go-Back-N ARQ, sender window size
Dr. G. Balamurugan
42
Department of Electronics Engineering, MIT Campus
Selective Repeat ARQ
• Go-Back-N always discards out-of-order frames
– Losing one frame may result in retransmission of multiple
frames
– Very inefficient in noisy link
• Selective Repeat ARQ allows frames to be received out of order
– Therefore, receive window > 1
Receive Window
Dr. G. Balamurugan
44
Department of Electronics Engineering, MIT Campus
Selective Repeat ARQ, lost frame
• Frames 0 and 1 are accepted
when received because they
are in the range specified by
the receiver window. Same for
frame 3.
• Receiver sends a NAK2 to
show that frame 2 has not
been received and then sender
resends only frame 2 and it is
accepted as it is in the range
of the window.
Dr. G. Balamurugan
45
Department of Electronics Engineering, MIT Campus
Selective Repeat ARQ: Window Size
Dr. G. Balamurugan
46
Department of Electronics Engineering, MIT Campus
Issues – Buffer Size
• Go-back-n ARQ
—sender needs to keep a buffer equal to window size
• for possible retransmissions
—receiver does not need any buffer (for flow/error control)
•For m-bit sequence numbers
Send window: up to 2m -1 Receive window: Expecting Frame
• Selective repeat ARQ
—sender needs to keep a buffer of window size for
retransmissions
—receiver keeps a buffer equal to sender window size
•For m-bit sequence numbers
Send window: up to 2m-1 Receive window: up to 2m-1
Dr. G. Balamurugan
47
Department of Electronics Engineering, MIT Campus
Piggybacking
( Bidirectional transmission)
• Data are transferred both ways
• ACK are "piggybacked" with
data frames
Dr. G. Balamurugan
48
Department of Electronics Engineering, MIT Campus
Summary
• Flow control is the regulation of the sender’s data rate so that the receiver buffer does
not become overwhelmed.
• Error control is both error detection and error correction.
• In Stop-and-Wait ARQ, the sender sends a frame and waits for an acknowledgment
from the receiver before sending the next frame.
• In Go-Back-N ARQ, multiple frames can be in transmit at the same time. If there is an
error, retransmission begins with the last unacknowledged frame even if subsequent
frames have arrived correctly. Duplicate frames are discarded.
• In Selective Repeat ARQ, multiple frames can be in transit at the same time. If there is
an error, only the unacknowledged frame is retransmitted.
• Flow control mechanisms with sliding windows have control variables at both sender
and receiver sites.
• Piggybacking couples an acknowledgment with a data frame.
Dr. G. Balamurugan
49
Department of Electronics Engineering, MIT Campus
• In a Go-Back-N ARQ, if the window size is 63, what is the range of sequence
numbers? 0-62
Exactly 10
• For Stop-and-Wait ARQ, for 10 data packets sent, _______ acknowledgments
are needed.
Dr. G. Balamurugan
50
Department of Electronics Engineering, MIT Campus
• TheStop-and-Wait
_______Protocol has flow control, but not error control.
• In the _____ Protocol, the sender sends its frames one after
another with no regard to the receiver. Simplest
• In the _____ Protocol, the sender sends one frame, stops until it
receives confirmation from the receiver, and then sends the next
frame. Stop-and-Wait