Chapter - 3 Lecture 2 Flow and Error Control
Chapter - 3 Lecture 2 Flow and Error Control
1
Flow Control
• The responsibilities of both the transport (end-
to-end) and the data link layer (hop-to-hop).
• Flow control is needed since the sending entity
should not overwhelm the receiving entity
—Recipient needs some time to process incoming
packets
—If sender sends faster than recipient processes, then
buffer overflow occurs
• flow control prevents buffer overflow
2
1.1 Stop and Wait Flow Control
• Source transmits frame
• Destination receives frame and replies with
acknowledgement (ACK)
• Source waits for ACK before sending next frame
• Destination can stop flow by not sending ACK
• Works well for large frames
• Inefficient for smaller frames, link utilization will
be very low.
3
With the use
of multiple
frames for a
single
message, the
stop-and-wait
procedure
may be
inadequate.
Performance of stop-and-wait
L 8000 bits
d trans 9
8 microseconds
R 10 bps
U sender: utilization – fraction of time sender busy sending
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R microsec
onds
1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link
U L/R .008
= = = 0.00027
sender 30.008
RTT + L / R microsec
onds
Increase utilization
by a factor of 3!
U 3*L/R .024
= = = 0.0008
sender 30.008
RTT + L / R microsecon
ds
Transport Layer 3-8
1.2. Sliding Window Flow Control
• 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 W (called window size) frames
• Transmitter can send up to W frames without ACK
• Each frame is numbered
— Sequence number bounded by size of the sequence number
field (k bits)
— thus frames are numbered modulo 2k (0 … 2k-1)
• ACK includes number of next frame expected
9
Sliding Window Flow Control
(W = 7, k=3)
10
Example of a Sliding Window
Protocol (W = 7)
11
2. Error Control
• So far we have seen flow control mechanisms
where frames are transmitted without errors
—in real life any transmission facility may introduce
errors
• So we have to
—detect errors
—if possible, correct errors
—adopt flow control algorithms such that erroneous
frames are retransmitted
12
Error Control
• Actions to be taken against
—Lost frames
—Damaged frames
• Automatic repeat request (ARQ) mechanism
components
—Error detection
—Positive acknowledgment
—Retransmission after timeout
—Negative acknowledgement and retransmission
13
Automatic Repeat Request
(ARQ)
• Stop-and-wait ARQ
• Go-back-N ARQ
• Selective-reject (selective retransmission) ARQ
14
2.1 Stop and Wait ARQ
• Source transmits single frame
• Wait for ACK
• If received frame is damaged, discard it
—If transmitter receives no ACK within timeout,
retransmits
• If ACK damaged,transmitter will not recognize it
—Transmitter will retransmit after timeout
—Receiver gets two copies of frame, but disregards
one of them
—Use ACK0 and ACK1
• ACKi means “I am ready to receive frame i”
15
Stop-and-Wait ARQ –
Example
16
2.2 Go-Back-N ARQ
• Based on sliding window
• If no error, ACK as usual with next frame
expected
—ACKi means “I am ready to receive frame i” and “I
received all frames between i (not included) and my
previous ack”
• Sender uses window to control the number of
unacknowledged frames
• If error, reply with rejection (negative ack)
—Discard that frame and all future frames until the
frame in error is received correctly
—Transmitter must go back and retransmit that frame
and all subsequent frames
17
Go-Back-N ARQ
Normal operation
ACK1 is not
necessary if
ACK2 is sent:
Cumulative
ACK
Go-Back-N ARQ
21
Go-Back-N ARQ, sender window size
• Size of the sender window must be less than 2 m. Size of the
receiver is always 1. If m = 2, window size = 2 m – 1 = 3.
• Fig compares a window size of 3 and 4.
Accepts as
the 1st
frame in
the next
cycle-an
error
2.3 Selective Repeat ARQ, sender and receiver windows
• Go-Back-N ARQ simplifies the process at the receiver site. Receiver only keeps
track of only one variable, and there is no need to buffer out-of-order frames,
they are simply discarded.
• However, Go-Back-N ARQ protocol is inefficient for noisy link. It bandwidth
inefficient and slows down the transmission.
• In Selective Repeat ARQ, only the damaged frame is resent. More bandwidth
efficient but more complex processing at receiver.
• It defines a negative ACK (NAK) to report the sequence number of a damaged
frame before the timer expires.
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.
Selective Repeat ARQ, sender window size
• Size of the sender and receiver windows must be at most one-half of 2 m. If m =
2, window size should be 2 m /2 = 2. Fig compares a window size of 2 with a
window size of 3. Window size is 3 and all ACKs are lost, sender sends duplicate
of frame 0, window of the receiver expect to receive frame 0 (part of the
window), so accepts frame 0, as the 1st frame of the next cycle – an error.