arq protocol
TRANSCRIPT
-
8/7/2019 arq protocol
1/35
Flow control in the transport layerFlow control in the transport layer
refers to a set of procedures used torefers to a set of procedures used to
restrict the amount of data that therestrict the amount of data that thesender can send before waiting forsender can send before waiting for
acknowledgment.acknowledgment.
Error control in the data link layer isError control in the data link layer is
based on automatic repeat request,based on automatic repeat request,
which is the retransmission of data.which is the retransmission of data.
Flow Control & Error ControlFlow Control & Error Control
-
8/7/2019 arq protocol
2/35
Automatic RepeatAutomatic Repeat reQuestreQuest (ARQ) Protocols(ARQ) Protocols
Purpose: to ensure a sequence of
information packets is delivered in order
and without errors or duplicationsdespite transmission errors & losses
We will look at:
Stop-and-Wait ARQ
Go-Back N ARQ
Selective Repeat ARQ
-
8/7/2019 arq protocol
3/35
StopStop--andand--Wait ARQWait ARQ
Stop after Transmitting a Frame
Wait for an Acknowledgement
Transmitter Receiver
Packet
H
CRCH
Error FreePacket
ACK
Information Frame
CRC
Transmitter Receiver
Packet
H
CRCH
Error FreePacket
ACK
Information Frame
CRC
H : HeaderCRC : Cyclic Redundancy Check
(Error Detection)
-
8/7/2019 arq protocol
4/35
Importance ofSequence NumbersImportance ofSequence Numbers
y In Scenario B, the receiver accepts Frame 1 Twice
y How could the Receiver Know whether or Not it has Received Frame 1Correctly?
BY INCLUDING THE FRAME SEQUENCE NUMBER IN THE
HEADER
Sender Receiver
ACK
Timeout
Frame 0
Frame 1
Frame 1
ACK
Frame 2
Sender Receiver
ACK
Timeout
Frame 0
Frame 1
Frame 1
ACK
Frame 2
ACK
A B
-
8/7/2019 arq protocol
5/35
Sequence Numbers in ACK FramesSequence Numbers in ACK Frames
The sender may mistakenly
interpret ACK as it
assumes that the second
ACK was for Frame 1
How Could the Sender
Know which Frame does
an ACK correspond to?
BY INCLUDING THE
SEQUENCE NUMBER IN
THE ACK
Sender Receiver
ACK
Frame 0
Frame 0
Frame 1
ACK
Frame 2
ACK
C
Timeout
-
8/7/2019 arq protocol
6/35
StopStop--andand--Wait ARQ PerformanceWait ARQ Performance
y The Channel Idle Time (Wait for ACK) is anInefficiency because the channel is not used
Machine A Machine B
PhysicalChannel
First Frame-Bitenters Channels
Last Frame-Bitenters Channels
First Frame-Bitarrives at B
Last Frame-Bitarrives at B
LastACK
-BitArrives atA
ProcessingTime
Channelis Idle
-
8/7/2019 arq protocol
7/35
StopStop--andand--Wait ARQ EfficiencyWait ARQ EfficiencyMachine A Machine B
PhysicalChannel
t0=TotalTime toTransmit1 Frame
tprop
tf=Lf/R
tproc
ta=La/R
tprop
tproc
t0=2tprop+2tproc+tf+tat0=2t
prop+2t
proc+L
f/R+L
a/R
tprop Propagation Timetproc Processing Timetf Frame TransmissionTimeta ACKTransmissionTimeLf No. ofBits/Frame
La No. ofBits/ACK
-
8/7/2019 arq protocol
8/35
0
No. of Inormation Bits per Frame
Time Required to Deliver One Frame
f h
eff
L LR
t
! !
ErrorError--Free ChannelFree Channel
N o E r ro r
0
1
2
1
! ! !
h
e ff f h f
p r o c p r o pa
f f
t t t
Effective Transmission RateHeaders and
CRC
Transmission EfficiencyEffect ofHeader
Effect ofACK
Effect of DelayBandwidth Product
fficiency Assuming RROR FR CHANNN LNE
N
-
8/7/2019 arq protocol
9/35
GoGo--BackBack--N BasicsN Basics
Transmit without waiting for ACK
Each frame received correctly is
acknowledged with a sequence numbercorresponding to the NEXT frameexpected
The receiver discards all out of sequence
packetsIf number of outstanding frames isW
S:
Go-Back-N
-
8/7/2019 arq protocol
10/35
What doesWWhat doesWSS
Represent?Represent?
yWS
is called the sending window size
y Each frame must be buffered (stored)
until a valid ACK arrives (in caseretransmission is needed)
yWS
represents the maximum number
of frames that may be outstanding (i.e.,stored) simultaneously
-
8/7/2019 arq protocol
11/35
GoGo--BackBack--N ARQN ARQ
ProtocolProtocol
Anoutstandingframe:
It is a frame that hasbeen
transmitted and is yet tobe acknowledged
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Fr_3
Fr_4
Fr_5
Fr_6
Fr_7
Fr_8
ACK_4
ACK_5
ACK_6
ACK_7
ACK_8
At this Pointthere areWS=4
OutstandingFrames. So,GO-BACK-4
Out of
SequenceFrames. So,do not accept
them
-
8/7/2019 arq protocol
12/35
TimeTime--out Driven Goout Driven Go--BackBack--NN
y For Go-Back-N withWs= 4
What happens if thesender only has 2frames to send
x No retransmission istriggered because thewindow is not full
y Time-out Driven Go-Back N
Timer per
outstand
ing
frame
If the window is full nofurther transmissionsare allowed
Sender Receiver
Fr_0
Fr_1
ACK_1
Fr_0
Fr_1
ACK_2
TimeoutOut of
sequence,ignored
-
8/7/2019 arq protocol
13/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_2
Fr_3
-
8/7/2019 arq protocol
14/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_2
Fr_3
-
8/7/2019 arq protocol
15/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_2
Fr_3
-
8/7/2019 arq protocol
16/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_2
Fr_3
-
8/7/2019 arq protocol
17/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_1
Fr_2
Fr_3
Fr_4
-
8/7/2019 arq protocol
18/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_2
Fr_3
Fr_4
Fr_5
-
8/7/2019 arq protocol
19/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_3
Fr_4
Fr_5
Fr_6
-
8/7/2019 arq protocol
20/35
SlidingWindow ConceptSlidingWindow Concepty Go Back N is an example of what is called a sliding window protocol
y An ACK received means that all previous frames have been receivedcorrectly (previous ACKs were lost or receiver chose not to sendthem)
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
Fr_6
ACK_1
ACK_2
ACK_3
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_4
Fr_5
Fr_6
Fr_7ACK_4
Transmitter has
nothing to send
-
8/7/2019 arq protocol
21/35
Header Bits for SequencingHeader Bits for Sequencing
y The frame sequence numbers cannot be allowedto keep on increasing to infinity. WHY?
Headers must be limited in size
An increase in header size means inefficiency
y Ifm bits are devoted for carrying the sequencenumbers
Frame sequence numbers may go from 0up to 2m-1
y IMPORTANT REQUIREMENT: The receivermust have the ability to unambiguously identify the
received frame
Window Size MUST BE smaller than 2m
-
8/7/2019 arq protocol
22/35
Go-Back-N ARQ: sender window size
-
8/7/2019 arq protocol
23/35
Selective Repeat ARQ ProtocolSelective Repeat ARQ Protocol
What is the problem of Go-Back N?Go Back-N retransmits the erroneous
frame and all subsequent frames
This reduces efficiency especially forHigh Error Channels
Selective Repeat ARQIntroduce a receive window to store
CORRECT out of sequence framesRetransmit individual frames
TCP uses a form of selective repeat
-
8/7/2019 arq protocol
24/35
Error Recovery in SelectiveError Recovery in Selective
Repeat ARQRepeat ARQ
Sender Receiver
Fr_0
Fr_1
Fr_2
Fr_3
Fr_4
Fr_5
ACK_1
ACK_2
NAK_2
Fr_2
ACK_2
ACK_2
Fr_6 ACK_6
ACK_7
-
8/7/2019 arq protocol
25/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_0
Fr_1
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
WS=WR=2 , m=2
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
-
8/7/2019 arq protocol
26/35
Operation ofSelective RepeatOperation ofSelective Repeat
WS=WR=2 , m=2
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_0
Fr_1
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
-
8/7/2019 arq protocol
27/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_0
Fr_1
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
28/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_0
Fr_1
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
29/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_0
Fr_1
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
30/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_0
Fr_1
Fr_2
Fr_3
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
31/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_2
Fr_3
Fr_2
Fr_3
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
32/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_2
Fr_3
Fr_2
Fr_3
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
33/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_2
Fr_3
Fr_3
Fr_0
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
34/35
Operation ofSelective RepeatOperation ofSelective Repeat
Sending Window
Frame Sequences thatare allowed to be sent
Outstanding FrameSequences
Fr_2
Fr_3
Fr_3
Fr_0
Frame Sequences that areallowed to be received
Frame Sequences thatare received correctlyand buffered
Receiving Window
Sender Receiver
Fr_0
Fr_1
Fr_0
NAK_0
ACK_2
Fr_2
ACK_3Fr_3
ACK_0
WS=WR=2 , m=2
-
8/7/2019 arq protocol
35/35
Selective Repeat ARQ, sender window size