Sei sulla pagina 1di 13

1

ECE361S Computer Networks 1


5.2: ARQ Protocols
ECE361S - Computer Networks
Shahrokh Valaee
ECE361S Computer Networks 2
ARQ Protocols
To achieve reliable communication channels
Forward Error Correction
Error detection + Retransmission (ARQ)
ARQ protocols can be implemented in
Data-link layer (hop-by-hop)
Transport layer (end-to-end)
2
ECE361S Computer Networks 3
Basic elements of ARQ
Packet
sequence
Error-free
packet
sequence
Information
frames
Control
frames
Transmitter Receiver
CRC
Information
packet
Header
Station A Station B
Information Frame
Control frame
CRC
Header
ECE361S Computer Networks 4
Stop-and-Wait ARQ
A
B
frame
0
frame
1
ACK
frame
2
time
Time-out
frame
2
ACK
3
ECE361S Computer Networks 5
Stop-and-Wait ARQ: possible ambiguities
(a) Frame 1 lost
A
B
frame
0
frame
1
ACK
frame
1
ACK
time
Time-out
frame
2
(b) ACK lost
A
B
frame
0
frame
1
ACK
frame
1
ACK
time
Time-out
frame
2
ACK
In parts (a) and (b) transmitting station A acts the same way, but part (b)
receiving station B accepts frame 1 twice.
Frames must be numbered
ECE361S Computer Networks 6
Stop-and-Wait ARQ: possible ambiguities
A
B
frame
0 frame
0
ACK
frame
1
ACK
time
time-out
frame
2
Transmitting station A misinterprets duplicate ACKs
Problem: premature time-out combined with loss of I-frame.
ACK must be numbered
4
ECE361S Computer Networks 7
S-a-W ARQ: System state information
Transmitter
Receiver
S
last
R
next
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
(0,0) (0,1)
(1,0) (1,1)
Timer
Global State:
(S
last
, R
next
)
Error-free frame 0
arrives at receiver
ACK for frame 0
arrives at
transmitter
ACK for frame
1 arrives at
transmitter
Error-free frame 1
arrives at receiver
Station A
Station B
R
next
S
last
ECE361S Computer Networks 8
Stop-and-Wait ARQ enquiry frame
(a) Frame 1 lost
A
B
frame
0
frame
1
ACK
1
ENQ
ACK
1
time
Time-out
frame
1
(b) ACK for frame 1 lost
A
B
frame
0
frame
1
ACK
1
ENQ
ACK
0
time
Time-out
frame
0
ACK
0
5
ECE361S Computer Networks 9
Delay components in Stop-and-Wait ARQ
t
f
= n
f
/R
t
prop
: one way propagation delay
t
proc
: frame processing time
t
ack
=n
a
/R
t
0
= 2 t
proc
+ 2 t
prop
+ t
f
+ t
ack
frame
t
f
time
A
B
t
prop
t
ack
t
proc
t
prop
t
proc
t
0
t
out
ECE361S Computer Networks 10
Go-Back-N ARQ
Transmitters rule of action
Keeps transmitting frames continuously
If any frame is not acknowledged Tout after the frame
is transmitted (or receives its NACK), assume that the
frame is lost and retransmit all frames from the lost
frame.
Receivers rule of action
Transmits an acknowledge frame to the transmitter
whenever a frame is delivered without any error
If duplicated frames arrives, assume that the previous
acknowledgment for the frame is lost.
6
ECE361S Computer Networks 11
Go-Back-N ARQ
A
B
fr
0
time
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
3
A
C
K
1
error
Out-of-sequence frames
Go-Back-4:
4 frames are outstanding; so go back 4
fr
5
fr
6
fr
4
fr
7
fr
8
fr
9
A
C
K
2
A
C
K
3
A
C
K
4
A
C
K
5
A
C
K
6
A
C
K
7
A
C
K
8
A
C
K
9
ECE361S Computer Networks 12
Stop-and-Wait versus Go-Back-N
A
B
fr
0
time fr
1
fr
2
fr
3
fr
0
error
Out-of-sequence frames
4 frames are outstanding; so go back 4
fr
2
fr
3
fr
1
fr
4
fr
5
fr
6
A
B
time fr
0
fr
0
error
Time-out expires
fr
1
A
C
K
1
STOP-AND-WAIT
GO-BACK-N
A
C
K
1
A
C
K
2
A
C
K
3
A
C
K
4
A
C
K
5
A
C
K
6
7
ECE361S Computer Networks 13
Go-Back-N ARQ: sliding window protocol
Timer S
last
S
last
+1
S
recent
S
last
+W
s
-1
Timer
Timer
TRANSMITTER
RECEIVER
...
Receive Window
Buffers
S
last
S
last
+W
s
-1
...
Send Window
S
recent
Frames
transmitted
and ACKed
R
next
frames
received
The receiver will only accept
a frame that is error-free and
that has sequence number R
next
...
ECE361S Computer Networks 14
Go-Back-N ARQ: window size
A
B
fr
0
time
fr
1
fr
2
fr
3
fr
0
fr
1
fr
2
fr
3
A
C
K
1
M =2
2
= 4, Go-Back - 4:
A
C
K
4
A
C
K
2
A
C
K
3
Transmitter goes back 4
Receiver has R
next
=0, but it does not
know whether its ACK for frame 0
was received, so it does not know
whether this is the old frame 0 or a
new frame 0
A
B
fr
0
time
fr
1
fr
2
fr
0
fr
1
fr
2
A
C
K
1
M=2
2
=4, Go-Back-3:
A
C
K
2
A
C
K
3
Transmitter goes back 3
Receiver has R
next
=3 , so it rejects the old
frame 0
8
ECE361S Computer Networks 15
NACK error recovery
A
B
fr
0
time fr
1
fr
2
fr
3
fr
4
fr
5
fr
1
fr
2
A
C
K
1
error
Out-of-sequence
frames
Go-Back-7:
fr
4
fr
5
fr
3
fr
6
fr
7
fr
0
N
A
K
1
A
C
K
3
A
C
K
4
A
C
K
5
A
C
K
6
A
C
K
7
A
C
K
2
Transmitter goes back to frame 1
ECE361S Computer Networks 16
Bidirectional Go-Back-N
Transmitter
Receiver
Transmitter
Receiver
ACKs are piggybacked in headers
Station A
Station B
S
A
recent
R
A
next
S
B
recent
R
B
next
R
A
next
A Receive Window
S
A
last S
A
last
+W
A
s
-1
...
A Send Window
S
A
last
S
A
last
+1
S
A
recent
S
A
last
+W
A
s
-1 Timer
...
Buffers
...
Timer
Timer
Timer
R
B
next
B Receive Window
S
B
last S
B
last
+W
B
s
-1
...
B Send Window
S
B
last
+1
S
B
recent
S
B
last
+W
B
s
-1
...
Buffers
...
Timer
Timer
Timer
Timer
S
B
last
9
ECE361S Computer Networks 17
Selective Repeat ARQ
Transmitters rule of action
Keeps transmitting frames continuously
If any frame is not acknowledged Tout after the frame is
transmitted (or receives NACK), assume that the frame is lost and
retransmit only the lost frame
Receivers rule of action
Does the same action as in the Stop-and-Wait ARQ, but never
discard all frames delivered without errors and has the capability to
reorder them in the correct order
Sequence numbers are required to identify
different frames
Transmitters must have timers for all frames on
the fly
ECE361S Computer Networks 18
Selective Repeat ARQ
Buffers
Timer S
last
S
last
+1
S
recent
S
last
+W
s
-1
Timer
Timer
...
...
R
next
+1
R
next
+2
R
next
+W
r
-1
...
Buffers
Transmitter
Receiver
S
last
S
last
+W
s
-1
...
Send Window
S
recent
Frames
transmitted
and ACKed
Receive Window
R
next
Frames
received
R
next
+W
r
-1
10
ECE361S Computer Networks 19
Error recovery in Selective Repeat ARQ
A
B
fr
0
time fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
2
A
C
K
1
error
fr
8
fr
9
fr
7
fr
10
fr
11
fr
12
A
C
K
2
N
A
K
2
A
C
K
7
A
C
K
8
A
C
K
9
A
C
K
1
0
A
C
K
1
1
A
C
K
1
2
A
C
K
2
A
C
K
2
A
C
K
2
ECE361S Computer Networks 20
Window Size in Selective Repeat ARQ
A
B
fr
0
time
fr
1
fr
0
A
C
K
1
Send Window = Receive Window = 2
A
C
K
2
Receive Window {2,3}
Frame 0 resent
frame 0 rejected
A
B
fr
0
time
fr
1
fr
2
fr
0
A
C
K
1
M=2
2
=4, Selective Repeat: Send Window = Receive Window = 3
A
C
K
2
A
C
K
3
Receive Window
{3,0,1}
Frame 0 resent
11
ECE361S Computer Networks 21
0 0
0
0
1
2( )
1
f
f
prop proc
a
f f
n n n
n
t
t t R
n R
n n



= =
+
+ +
Transmission efficiency in Stop&Wait ARQ
0
0
0
f
eff
n n
t
R

=
Without errors
Delay-Bandwidth product
Header and CRC
overhead
Time for ACK/NACK
ECE361S Computer Networks 22
With errors:
[ ]
0
0
0
0
) 1 ( ) 1 (
f
f
f
total
f
P
R t
n n
P
R
t E
n n
=

=
Probability of independent bit error: p
e
Probability of a corrupted info. or ACK frame:
1 (1 ) ( )
f a
n n
f e f a e
P p n n p
+
= +
for p
e
<<1
Transmission efficiency in Stop&Wait ARQ
12
ECE361S Computer Networks 23
Transmission efficiency in Go-Back-N ARQ
Efficiency
0 0
1
[ ]
(1 ) (1 )
1 ( 1)
f
f
total
f f
s f
n n n
n
E t
P P
R W P


= =
+
W
s
: Window size
ECE361S Computer Networks 24
Efficiency in Selective Repeat ARQ
Efficiency
0
(1 )(1 )
f
f
n
P
n
=
13
ECE361S Computer Networks 25
Transmission Efficiency of ARQ Protocols
0
0.2
0.4
0.6
0.8
1
1
.
E
-
0
1
5
.
E
-
0
2
1
.
E
-
0
2
5
.
E
-
0
3
1
.
E
-
0
3
5
.
E
-
0
4
1
.
E
-
0
4
5
.
E
-
0
5
1
.
E
-
0
5
5
.
E
-
0
6
1
.
E
-
0
6
5
.
E
-
0
7
1
.
E
-
0
7
Selective Repeat
Go-Back-N
Stop & Wait
p

0
(1 )(1 )
f
f
n
P
n
=
0
1
(1 )
1 ( 1)
f
f
s f
n
n
P
W P


=
+
0
1
(1 )
2( )
1
f
f
prop proc
a
f f
n
n
P
t t R
n
n n


=
+
+ +
ECE361S Computer Networks 26
Optimum Frame Size
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
32 64 128 256 512 1024 1536 2048
n
f

Selective Repeat
Go-Back-N
Stop &Wait
62
32
17
10
6
3
3
3

Potrebbero piacerti anche