Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

ARQ Protocols and Reliable Data

Transfer
Three standardized versions Of ARQ:

Stop-and-wait ARQ (contd..)


Go-back-N ARQ
Selective-repeat ARQ
Stop-and-Wait Efficiency
Last frame bit ACK
First frame bit enters channel arrives
enters channel Channel idle while transmitter
waits for ACK

A t

B t

First frame bit Receiver


arrives at Last frame bit processes frame
receiver arrives at and
receiver prepares ACK
Stop-and-Wait Model

t 0  2t prop  2t proc  t f  t ack bits/info frame


nf na
 2t prop  2t proc   bits/ACK frame
R R
channel transmission rate
S&W Efficiency on Error-free channel
Effective transmission rate: Overhead bits for header & CRC

number of informatio n bits delivered to destinatio n n f  no


R0
eff   ,
total time required to deliver th e informatio n bits t0

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

nf=1250 bytes = 10000 bits, na=no=25 bytes = 200 bits


2(tprop+tproc) 1 ms 10 ms 100 ms 1 sec
(Distance)
(200 (2000 km) (20000 km) (200000 km)
km)
DB Prod (R=1 103 104 105 106
Mbps)
Efficiency 88% 49% 9% 1%
DB Prod (R=1 106 107 108 109
Gbps)
Efficiency 1% 0.1% 0.01% 0.001%
Stop-and-Wait does not work well for very high speeds or
long propagation delays
6
S&W Efficiency in Channel with Errors
Let 1 – Pf = probability frame arrives without errors
Avg. no of transmissions to first correct arrival is then 1/ (1–Pf )
Avg. Total Time per frame is then t0/(1 – Pf)

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 Nr is the number of expected transmission per frame, then

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)

Bit errors impact performance as nfp approaches 1


S&W Efficiency on Error-free channel
(approx.)
Transmission efficiency: neglecting tproc and no
nf
Reff
t0 nf
0    .
R R n f  na  2t prop R
1 1 1
0   
na 2t prop R 2t prop R 2t prop
1  1 1
nf nf nf tf

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

Frame transmission are pipelined to keep the channel busy


Frame with errors and subsequent out-of-sequence frames are ignored
Transmitter is forced to go back when window of 4 is exhausted
Go-Back-N with Timeout
•Problem with Go-Back-N as presented:
If frame is lost and source does not have enough
frames (Ws-1) to send, then window will not be
exhausted and recovery will not commence
•Use a timeout with each frame
•When timeout expires, resend all outstanding
frames
Go-Back-N Transmitter & Receiver
Receiver
Transmitter

Send Window Receive Window


...

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

Send Window m-bit Sequence Numbering


...

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.

Transmitter goes back 4


fr fr fr fr fr fr fr fr Time
A 0 1 2 3 0 1 2 3

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

Example: Go-Back-3 is good.


Transmitter goes back 3
fr fr fr fr fr fr Time
A 0 1 2 0 1 2

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

• NAK will cause the sender to go back and


retransmit the lost frame immediately
• Generally go back less than WS frames
• As a result, the performance will be improved
• Only one NAK is allowed for any frame to avoid
retransmiting a lost frame multiple times
• In case NAK lost, no harm. The timer will do its
duty
ACK and NAK
ACK with Rnext:
acknowledge the receipt of all previous frames and ask to
transmit the frame with sequence number Rnext
NAK with Rnext:
acknowledge the receipt of all previous frames and ask to
retransmit the lost frame with sequence number Rnext
ACK Piggybacking in Bidirectional GBN
 In bi-directional communication, ACKs are
often piggybacked on data frames to reduce
overhead.

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

“A” Receive Window “B” Receive Window

RA next RB next
“A” Send Window “B” Send Window
... ...

SA last SA last+WA s-1 SB last SB last+WB s-1


Buffers Buffers
Timer SA last Timer SB last

Timer SA last+1 Note: Out-of-sequence Timer SBlast+1


... ...
error-free frames
Timer SArecent Timer SBrecent
... discarded after Rnext
...
A A
examined
Timer S last+W s-1 Timer SB last+WB s-1
Required Timeout & Window Size
Tout
Tproc

Tprop Tf Tf Tprop

• Timeout value should allow for:


• Two propagation times + 1 processing time: 2 Tprop +
Tproc
• A frame that begins transmission right before our
frame arrives : Tf
• Next frame carries the ACK: Tf
• So Tout>=2Tprop+2Tf+Tproc
• Ws should be large enough to keep channel busy for Tout
Efficiency of Go-Back-N ARQ

• In SW ARQ frame error results in the loss of


transmission time equal to the duration of the
time-out period.
• In Go-Back-N ARQ, the occurrence of a frame-
transmission error results in the loss of
transmission time corresponding to WS frames.
Link Efficiency in Presence of
Transmission Errors (Go-back_N)
Let Pf = probability that a frame arrives with errors
then, 1 – Pf = probability a frame arrives w/o errors
Let, Nr is the number of expected transmission per frame, then
If Nr=i, then (i-1) retransmission of Ws frames followed by single
successful transmission of Ws.
Therefore, Avg. total time required to deliver the frame
 

EGBN  t f 1  Ws  (i  1) Pr (i transmissions)
 i 1 
 

 t f 1  Ws  (i  1)(1  Pf ) Pfi 1 
 i 1 

 Pf   
1  (Ws  1) Pf 

 t f 1  Ws   tf  

 (1  Pf ) 
  (1  Pf )
 

Efficiency of Go-Back-N
n f  no no
1
E[tGBN ] nf
GBN   (1  Pf )
R 1  (Ws  1) Pf
For Pf  0
no
GBN  1
nf
• GBN is completely efficient, if Ws large enough to keep
channel busy, and if channel is error-free
Applications of Go-Back-N ARQ

HDLC (High-Level Data Link Control): bit-


oriented data link control
V.42 modem: error control over telephone
modem links
Three standardized versions Of ARQ:

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

Send Window Receive Window


...

Frames Frames
transmitted Slast Srecent
received Rnext Rnext + Wr-1
and ACKed Slast+ Ws-1

Buffers Buffers
Timer Slast Rnext+ 1

Timer Slast+ 1 Rnext+ 2


...
...
Timer
Srecent
Rnext+ Wr- 1 max Seq no.
... accepted

Slast+ Ws - 1 WR: size of receive window


Send
Transmitter
& Receive Windows
Receiver
0 0
2m-1 1 2m-1 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?

 Example: M=22=4, Ws=3, Wr=3


Frame 0 resent
Send
{0,1,2} {1,2} {2} {.}
Window
fr0 fr1 fr2 fr0
A Time

B ACK1 ACK2 ACK3


Receive
{0,1,2} {1,2,3} {2,3,0} {3,0,1}
Window
Old frame 0 accepted as a
new frame because it falls
in the receive window
Ws + Wr = 2m is maximum allowed
 Example: M=22=4, Ws=2, Wr=2
Frame 0 resent
Send
{0,1} {1} {.}
Window
fr0 fr1 fr0
A Time

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

TCP (Transmission Control Protocol): transport


layer protocol uses variation of selective repeat
to provide reliable stream service
SSCOP (Service Specific Connection Oriented
Protocol): error control for signaling messages
in ATM networks
Comparison of ARQ Efficiencies
Assume na and no are negligible relative to nf, and L = 2(tprop+tproc)R/nf
=(Ws-1), then

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

0.5 Stop and Wait


100
0 Go Back N 100
-9-9 10
10 -8-8 10
-7-7 10
-6-6 10
-5-5 10
-4-4 10
-3-3 -2
10-2 -1
10-1

- LOG(p)
p Stop and Wait
10
Delay-Bandwidth product = 10, 100

You might also like