Professional Documents
Culture Documents
ARQ Protocols and Reliable Data Transfer
ARQ Protocols and Reliable Data Transfer
Transfer
Three standardized versions Of ARQ:
A t
B t
Transmission efficiency:
Effect of
n f no no frame overhead
1
Reff t0 nf
0 .
R R na 2(t prop t proc ) R
1
nf nf
Effect of
Effect of
Delay-Bandwidth Product
5
ACK frame
Example: Impact of Delay-Bandwidth Product
n f no
no
t0 1
Reff 1 Pf nf
SW (1 Pf )
R R na 2(t prop t proc ) R
1
nf nf
Effect of
frame loss
S&W Efficiency in Channel with Errors
If we assume that ACKs are never in error, then the probability that
it will take k attempts to transmit a frame successfully is Pf k-1(1-Pf).
In that case, we will have (k-1) unsuccessful attempts followed by
one successful attempt. The expected number of transmission (avg)
is then -
N r E[transmission] i Pr (i transmissions)
i 1
1
i Pfi 1 (1 Pf )
i 1 (1 Pf )
Example: Impact Bit Error Rate
nf=1250 bytes = 10000 bits, na=no=25 bytes = 200 bits
Find efficiency for random bit errors with p=0, 10-6, 10-5, 10-4
n f p
1 Pf (1 p) e
nf
for large n f and small p
p 0 10-6 10-5 10-4
1 – Pf (R=1
Mbps
1 0.99 0.905 0.368
& 2(tprop+tproc)= 88% 86.6% 79.2% 32.2%
1 ms)
t prop
- Link utilization factor
tf
S&W Efficiency in Channel with Errors
(approx.)
Let transmitter waits for TO (time-out) period in case of
unsuccessful transmission
Pf
Expected total time E[X] t0 TO
(1 Pf )
nf
Pf
t0 TO
Reff (1 Pf )
0
R R
Where
TO=tf in a full duplex system (data is transmitted in both directions)
TO=t0 in a half duplex system (data is transmitted in one direction,
link is bi-directional)
S&W Efficiency in Channel with Errors
(approx.)
In a half duplex system
Pf
Expected total time E[X] t0 t0
(1 Pf )
nf
t0
Reff (1 Pf ) 1 1
0 (1 Pf ) (1 Pf )
R R 2t prop R 2t prop
1 1
nf tf
Three standardized versions Of ARQ:
Stop-and-wait ARQ
Go-back-N ARQ
Selective-repeat ARQ
Go back N ARQ
• S&W ARQ is simple, but ineffective.
• Go back n ARQ is the most popular
scheme.
• Idea: several successive packets can be
sent w/o waiting for the next packet to be
requested.
• a.k.a. sliding window ARQ
Go-Back-N
•Improve Stop-and-Wait by not waiting!
•Keep channel busy by continuing to send frames
•Allow a window of up to Ws outstanding frames
•Use m-bit sequence numbering
•If ACK for oldest frame arrives before window is
exhausted, we can continue transmitting
•If window is exhausted, pull back and retransmit all
outstanding frames
•Alternative: Use timeout
Go-Back-N ARQ
Go-Back-4: 4 frames are outstanding; so go back 4
fr fr fr fr fr fr fr fr fr fr fr fr fr fr Time
0 1 2 3 4 5 6 3 4 5 6 7 8 9
A
B
A A A out of sequence A A A A A A
C C C frames C C C C C C
K K K K K K K K K
Next frame expected 1 2 3 4 5 6 7 8 9
Rnext 0 1 2 3 4 5 6 7 8 9
Frames
transmitted S
last Srecent Slast+Ws-1
and ACKed
Frames
Buffers received Rnext
oldest un-
Timer Slast Receiver maintains a receive
ACKed frame
window of size 1
Timer Slast+1
... Receiver will only accept
Timer
Srecent most recent a frame that is error-free and
transmission that has sequence number Rnext
...
When such frame arrives Rnext is
Slast+Ws-1 max Seq no. incremented by one, so the
allowed
receive window slides forward by
one
Sliding Window Operation
Transmitter
Frames
transmitted S
0
last Srecent Slast+Ws-1 2m – 1 1
and ACKed
2
Transmitter waits for error-free
ACK frame with sequence Slast
number Slast
send
When such ACK frame arrives, window i
Slast is incremented by one, and
the send window slides forward i + Ws – 1 i+1
by one
Window Size and m
Example: M = 22 = 4, Go-Back – 4 is not good.
A A A A
B C C C C Receiver has Rnext= 0, but it does not
K K K K know whether this is the old frame 0 or
1 2 3 0
a new frame 0
Rnext 0 1 2 3 0
Window Size and m
•The example uses 2m=4 sequence no.
•The transmitter initially sends four frames in a
row. The receiver sends four corresponding
acknowledgments, which are all obliterated in the
return channel.
•When the transmitter exhausts its available frame
numbers, it goes back four and begins
retransmitting from frame 0.
•When frame 0 arrives at the receiver, the receiver
has Rnext = 0, so it accepts the frame.
Window Size and m
A A A
B C C C
K K K Receiver has Rnext= 3 , so it
1 2 3
rejects the old frame 0
Rnext 0 1 2 3
Window Size and m
• Acknowledgment for frame 0 has been received
at the transmitter.
• Therefore, any receipt of frame 0 prior to frame
WS indicates a duplicate transmission of frame 0.
In Go-Back-N ARQ, the size of the send
window must be less than 2m,
the size of the receiver window
is always 1.
NAK message to improve the performance of Go-back-N
NAK: Negative AcKnowledgment
Transmitter goes back to frame 1
Go-Back-7:
fr fr fr fr fr fr fr fr fr fr fr fr fr fr time
0 1 2 3 4 5 1 2 3 4 5 6 7 0
A
B
A N Out-of-sequence A A A A A A
C A frames C C C C C C
K K K K K K K K
1 1 2 3 4 5 6 7
error
When the receiver receives a out-of sequence frame, it sends back an NAK.
NAK with Rnext will inform the sender of:
1.all frames up to Rnext –1 have been received successfully
2. There exists error with frame Rnext, so the frame need to be retransmitted
3. Frames after Rnext have been received and discarded
More about NAK
SArecent RA next
Transmitter Receiver
Receiver Transmitter
SBrecent RB next
Go-back-N with bidirectional information flow
• Go-back-N algorithm is running in both A and B
• Each direction has both I-frames and control frames
• Many control frames can be deleted by piggybacking
the acknowledgments in the header of I-frames
• When a error-free frame is received, the receiver
inserts the ACK in its next departing I-frame,
• ACK timer: is set to wait for availability of I-frame, if
expire, an ACK control frame is sent.
• For out-of-sequence frames:
• Examine their ACK part (i.e, Rnext) to update its
Slast, then discard.
ACK Piggybacking in Bidirectional GBN
SArecent RA next
Transmitter Receiver
Receiver Transmitter
SBrecent RB next
RA next RB next
“A” Send Window “B” Send Window
... ...
Tprop Tf Tf Tprop
Stop-and-wait ARQ
Go-back-N ARQ
Selective-repeat ARQ
Selective Repeat ARQ
• Go-Back-N ARQ inefficient because multiple
frames are resent when errors or losses occur
• The receive window is made larger than one
frame so that the out-of-order but error free
frames can be kept, not discarded
• Retransmission mechanism is modified so that
only individual frames are retransmitted, not
entire frames in send window
Selective Repeat ARQ
• Selective Repeat retransmits only an individual frame
• Timeout causes individual corresponding frame to be resent
•Receiver maintains a receive window of sequence numbers
that can be accepted
• Error-free, but out-of-sequence frames with sequence numbers within
the receive window are buffered
• Arrival of frame with Rnext causes window to slide forward by 1 or more
• NAK causes retransmission of oldest un-acked frame
Selective Repeat ARQ
fr fr fr fr fr fr fr fr fr fr fr fr fr fr Time
0 1 2 3 4 5 6 2 7 8 9 10 11 12
A
B
A A N A A A A A A A A A
C C A C C C C C C C C C
K K K K K K K K K K K K
1 2 2 2 2 2 7 8 9 1 1 1
0 1 2
•Retransmit a frame when the frame’s timer times out or a NAK
for the frame is received
•Rnext may increase more than one due to the out-of-sequence frames
following Rnext may have been received and buffered by receiver
Selective Repeat ARQ
Transmitter Receiver
Frames Frames
transmitted Slast Srecent
received Rnext Rnext + Wr-1
and ACKed Slast+ Ws-1
Buffers Buffers
Timer Slast Rnext+ 1
2 2
Rnext
Slast
send receive j
window i window
i
i + Ws – 1 i+1
j + Wr – 1
Moves k forward when ACK Moves forward by 1 or more
arrives with Rnext = Slast + k when frame arrives with
k = 1, …, Ws-1 Seq. # = Rnext
What size Ws and Wr allowed?
B ACK1 ACK2
Receive
{0,1} {1,2} {2,3}
Window
Old frame 0 rejected because it
falls outside the receive window
Why Ws + Wr = 2m works
The number of bits, m, is enough to label all
outstanding frames.
Usually, Ws = Wr = 2m-1
0 0
2m-1 1 2m-1 1
Slast Ws +Wr-1 2
2
receive Rnext Ws
send window
window Ws-1
Efficiency of Selective Repeat ARQ
Let Pf = probability that a frame arrives with errors
then, 1 – Pf = probability a frame arrives w/o errors
Each transmission error involves only the retransmission of the
specific frame
Therefore, Avg. total time required to deliver the frame
i 1
E [t SR ] t f 1 (i 1)(1 Pf ) Pf
i 1
Pf 1
t f 1 tf
1 Pf 1 Pf
n f no
t f /(1 Pf ) no
SR (1 )(1 Pf )
R nf
Applications of Selective Repeat ARQ
Selective-Repeat:
no
SR (1 Pf )(1 ) (1 Pf )
nf
Go-Back-N:
For Pf≈0, SR & GBN same
1 Pf 1 Pf
GBN
1 (WS 1) Pf 1 LPf
For Pf→1, GBN & SW same
Stop-and-Wait:
(1 Pf ) 1 Pf
SW
na 2(t prop t proc ) R 1 L
1
nf nf
ARQ Efficiencies
ARQ Efficiency Com parison
Selective
1.5 Repeat
Go Back N 10
Efficiency
- LOG(p)
p Stop and Wait
10
Delay-Bandwidth product = 10, 100