Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
= round-trip time
Error Control (cont.) 3
frame
frame
ACK
frame ACK
buffer of
frame finite size
Flow Control – set of procedures used to restrict the amount of data that
sender can send while waiting for acknowledgment
• two main strategies
(1) Stop-and-Wait: sender waits until it receives ACK
before sending next frame
(2) Sliding Window: sender can send W frames before
waiting for ACKs
= round-trip time
Stop-and-Wait ARQ (cont.) 7
0
frame frame 0
ACK ACK
1
frame frame 1
ACK ACK
2
frame frame 2
ACK ACK
retransmitted 2 Receiver has already
frame frame 2
frame How will receiver know received frame 2 –
that this is NOT it resends an ACK and
a new packet?! discards the duplicate.
0 0
frame 0 frame 0
0
ACK ACK 1
receiver sees this as 0 0
ACK for 2nd frame-0 frame 0 frame 0
and sends frame-1 1 ACK 1 ACK 1 0
http://www.net-seal.net/animations.php?aid=37
Stop-and-Wait ARQ (cont.) 10
nACK bits
B
frame
tprop tproc tack tprop
tf time
first frame bit end of ACK
arrives at end of frame first ACK bit is received
receiver is received arrives at
receiver
Stop-and-Wait ARQ (cont.) 11
nheader
(1) - loss in efficiency due to (need for) header
nf
n ACK
(2) - loss in efficiency due to (need for) ACKs
nf
nheader
1−
R eff nf 0.98
ηSW = = =
R n ACK 2 ⋅ (t prop + t proc )R 2 ⋅ (t prop + t proc )R
1+ + 1.02 +
nf nf nf
Stop-and-Wait does NOT work well for very high speeds or long propagation delays.
Stop-and-Wait ARQ (cont.) 15
n f − nheader
t0 nheader
1−
R eff_error (1- Pf ) nf
ηSW_error = = = (1- Pf ) ⋅ (∗)
R R n ACK 2(t + t )R
1+ + prop proc
nf nf
successful
average # of transmissions in error
before a successful transmission transmission
time-out time-out time-out t0
∞ ∞
E[# of transmissi ons in error] = ∑ (i - 1) ⋅ P[n trans in error = i - 1] = ∑ (i - 1) ⋅ (1− Pf )Pfi−1 =
i=1 i=1
∞ ∞
= (1− Pf ) ⋅ ∑ (i - 1) ⋅ P f
i−1
= (1− Pf ) ⋅ ∑ n ⋅ Pfn =
i=1 n =1
∞
1
= (1− Pf ) ⋅ Pf ⋅ ∑ n ⋅ Pfn−1 = (1− Pf ) ⋅ Pf ⋅ =
n =1 (1− Pf )2
Pf
=
1− Pf
Total average Pf 1
delay per frame: t 0 + time - out ⋅ E[# of transmiss in error] = t 0 + time - out ⋅ ≈ t0
1- Pf 1- Pf
Stop-and-Wait ARQ (cont.) 17
S(0) S(0)
0 R(0)
S(1) R(0) S(1)
0
1 R(1)
S(2) R(1) S(2)
1
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
1 2 3 4 5 6 7 8 9
Rnext 0 1 2 3 3 4 5 6 7 8 9
Assume: Ws= 4
1) sender sends frames one by one
2) frame 3 undergoes transmission error – receiver ignores frame 3 and all subsequent frames
3) sender eventually reaches max number of outstanding frames, and takes following action:
go back N=Ws frames and retransmit all frames from 3 onwards
Go-Back-N ARQ (cont.) 20
Window size
5 6 7 0 1 2 3 4 5 6 7 0 1 2 3
¢¤
Go-Back-N ARQ (cont.) 22
Note:
• ACKs number always defines the number of the next expected frame !!!
• in Go-Back-N, receiver does not have to acknowledge each frame received –
it can send one cumulative ACK for several frames
Go-Back-N ARQ (cont.) 23
ACK1
ACK1
ACK2
ACK2
ACK3
ACK3
ACK0
ACK3
ACK1
time
• transmission efficiency
n f − nheader n
1− header
ηGBN =
t GBN
=
nf
(1− Pf ) (∗∗)
R 1+ (Ws − 1)Pf
Go-Back-N ARQ (cont.) 25
successful successful
transmission transmission
WS WS
0 1 2 3 4 5 6 7 8 9 1011 0 1 2 3 4 5 6 7 R R R R R R R R 8 9 10 11
Pf
E[# of transmissions in error] =
1 − Pf
n f − nheader n
1− header
t GBN = t frame +
Pf
1 − Pf
WS ⋅ t frame ⇒ ηGBN =
t GBN
=
nf
(1− Pf )
R 1+ (Ws − 1)Pf
Go-Back-N ARQ (cont.) 26
Compare S&W with GBN efficiency for random bit errors with pb = 0, 10-6, 10-5, 10-4 and
bandwidth-delay product R*2*(tprop+tproc) = 1 Mbps * 100 ms = 100000 bits = 10 frames →
use Ws = 11.
11
already ACKed usable not yet sent out of order buffered acceptable
sent, not yet ACKed not usable but already ACKed (within window)
expected, not yet received not usable
Sender:
• window advances whenever an ACK
arrives
• if a timer expires, the corresponding
frame is resent, and the timer is reset
• whenever a NAK arrives, Rnext frame
is resent
Selective Repeat ARQ (cont.) 30
ACK1
ACK1
ACK2
ACK2
ACK3
• transmission efficiency
n f − nheader
ηSR
R
= eff =
t SR ⎛ n
= ⎜⎜1− header
⎞
⎟⎟ ⋅ (1− Pf ) (∗∗∗)
R R ⎝ nf ⎠
Selective Repeat ARQ (cont.) 32
0 1 2 3 4 5 6 7 8 9 1011 0 1 2 3 4 5 R 6 7 8 9 101112
tframe
NAK 0
nf − nheader
t SR = t frame +
Pf
1− Pf
⋅ t frame =
1 nf
⋅
1− Pf R
⇒ ηSR =
t SR ⎛ n
= ⎜⎜1− header
⎞
⎟⎟(1− Pf )
R ⎝ nf ⎠
Stop-and-Wait vs. Go-Back-N vs. Selective Repeat 33
Performance • assume nACK and nheader are negligible relative to nf, and
Comparison
2(t prop + t proc )R WS is for 1 less than the
= L = Ws − 1 number of frames currently in transit
nf
size of the “pipe” in
multiples of frames
ηSR = (1− Pf )
- LOG(p)
p Stop and Wait
10