0% found this document useful (0 votes)
57 views20 pages

Peer-to-Peer Protocols and Data Link Layer

This document summarizes key aspects of different automatic repeat request (ARQ) protocols used at the data link layer. It describes stop-and-wait ARQ, go-back-N ARQ, and selective repeat ARQ. Stop-and-wait ARQ ensures reliable data transfer through acknowledgments but has low efficiency. Go-back-N improves efficiency by allowing multiple outstanding frames but retransmits whole windows of frames. Selective repeat ARQ further improves efficiency by retransmitting only missing individual frames.

Uploaded by

Pk Goldbach
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views20 pages

Peer-to-Peer Protocols and Data Link Layer

This document summarizes key aspects of different automatic repeat request (ARQ) protocols used at the data link layer. It describes stop-and-wait ARQ, go-back-N ARQ, and selective repeat ARQ. Stop-and-wait ARQ ensures reliable data transfer through acknowledgments but has low efficiency. Go-back-N improves efficiency by allowing multiple outstanding frames but retransmits whole windows of frames. Selective repeat ARQ further improves efficiency by retransmitting only missing individual frames.

Uploaded by

Pk Goldbach
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Chapter 5

Peer-to-Peer Protocols
and Data Link Layer
Peer-to-Peer Protocols
Peer-to-Peer Protocols and Service Models
ARQ Protocols and Reliable Data Transfer
End-to-End vs. Hop-by-Hop
A service feature can be provided by implementing a
protocol
end-to-end across the network
across every hop in the network
Example:
Perform error control at every hop in the network or only
between the source and destination?
Perform flow control between every hop in the network or
only between source & destination?
Chapter 5
Peer-to-Peer Protocols
and Data Link Layer
ARQ Protocols and Reliable
Data Transfer

Purpose: to ensure a sequence of information
packets is delivered in order and without errors or
duplications despite transmission errors & losses
We will look at:
Stop-and-Wait ARQ
Go-Back N ARQ
Selective Repeat ARQ
Basic elements of ARQ:
Error-detecting code with high error coverage
ACKs (positive acknowledgments)
NAKs (negative acknowledgments)
Timeout mechanism
Automatic Repeat Request (ARQ)
CRC
Information
packet
Header
Information frame Control frame: ACKs
CRC
Header
Packet
Error-free
packet
Information frame
Control frame
Transmitter
(Process A)
Receiver
(Process B)
Stop-and-Wait ARQ
Timer set after
each frame
transmission
Transmit a frame, wait for ACK
In cases (a) & (b) the transmitting station A acts the same way
But in case (b) the receiving station B accepts frame 1 twice
Question: How is the receiver to know the second frame is also frame 1?
Answer: Add frame sequence number in header
S
last
is sequence number of most recent transmitted frame
Need for Sequence Numbers
(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
Sequence Numbers
The transmitting station A misinterprets duplicate ACKs
Incorrectly assumes second ACK acknowledges Frame 1
Question: How is the receiver to know second ACK is for frame 0?
Answer: Add frame sequence number in ACK header
R
next
is sequence number of next frame expected by the receiver
Implicitly acknowledges receipt of all prior frames
(c) Premature Time-out
A
B
Frame
0
Frame
0
ACK
Frame
1
ACK
Time
Time-out
Frame
2
(0,0) (0,1)
(1,0) (1,1)
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
Transmitter
A
Receiver
B
S
last
R
next
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1
Timer
R
next
S
last
1-Bit Sequence Numbering
Suffices
Stop-and-Wait ARQ
Transmitter
Ready state
Await request from higher layer for
packet transfer
When request arrives, transmit
frame with updated S
last
and CRC
Go to Wait State
Wait state
Wait for ACK or timer to expire;
block requests from higher layer
If timeout expires
retransmit frame and reset timer
If ACK received:
If sequence number is incorrect or if
errors detected: ignore ACK
If sequence number is correct (R
next

= S
last
+1): accept frame, go to
Ready state
Receiver
Always in Ready State
Wait for arrival of new frame
When frame arrives, check for errors
If no errors detected and sequence
number is correct (S
last
=R
next
), then
accept frame,
update R
next
,
send ACK frame with R
next
,
deliver packet to higher layer
If no errors detected and wrong
sequence number
discard frame
send ACK frame with R
next
If errors detected
discard frame

Stop-and-Wait Efficiency
10000 bit frame @ 1 Mbps takes 10 ms to transmit
If wait for ACK = 1 ms, then efficiency = 10/11= 91%
If wait for ACK = 20 ms, then efficiency =10/30 = 33%
A
B
First frame bit
enters channel
Last frame bit
enters channel
Channel idle while transmitter
waits for ACK
Last frame bit
arrives at
receiver
Receiver
processes frame
and
prepares ACK
ACK
arrives
First frame bit
arrives at
receiver
t
t
frame
t
f
time
A
B
t
prop
t
ack
t
proc
t
prop
t
proc
t
0
= total time to transmit 1 frame

Stop-and-Wait Model
R
n
R
n
t t
t t t t t
a
f
proc prop
ack f proc prop


2 2
2 2
0
bits/info frame
channel transmission rate
bits/ACK frame
**Note:: The propagation and processing delays in an Ethernet LAN are
negligible compared to the total transmission time of a packet from start to finish.
S&W Efficiency on Error-free
channel
.
) ( 2
1
1
0
0
f
proc prop
f
a
f
o o f
eff
n
R t t
n
n
n
n
R
t
n n
R
R


bits for header & CRC
,
bits n informatio e deliver th to required time total
n destinatio to delivered bits n informatio of number
0
0
t
n n
R
o f
eff


Effect of
frame overhead
Effect of
ACK frame
Effect of
Delay-Bandwidth Product
Effective transmission rate:
Transmission efficiency:
The term 2(t
prop
+ t
proc
)R is
called the Delay-Bandwidth
Product
Example: Impact of Delay-
Bandwidth Product
n
f
=1250 bytes = 10000 bits, n
a
=n
o
=25 bytes = 200 bits
2(t
prop
+ t
proc
)
1 ms 10 ms 100 ms 1 sec
1 Mbps 10
3
88%
10
4
49%
10
5
9%
10
6

1%
1 Gbps 10
6
1%
10
7
0.1%
10
8
0.01%
10
9
0.001%
Stop-and-Wait does not work well for very high speeds
or long propagation delays
S&W Efficiency in Channel with
Errors
Let 1 P
f
= probability frame arrives w/o errors
Avg. # of transmissions to first correct arrival is then 1/ (1P
f
)
If 1-in-10 get through without error, then avg. 10 tries to
success
Avg. Total Time per frame is then t
0
/(1 P
f
)
) 1 (
) ( 2
1
1
1
0
f
f
proc prop
f
a
f
o
f
o f
eff
SW
P
n
R t t
n
n
n
n
R
P
t
n n
R
R


Effect of
frame loss
Example: Impact Bit Error Rate
n
f
=1250 bytes = 10000 bits, n
a
=n
o
=25 bytes = 200 bits
Find efficiency for random bit errors with p=0, 10
-6
, 10
-5
, 10
-4

1 Mbps
& 1 ms
0 10
-6
10
-5
10
-4

1 P
f

Efficiency
1
88%
0.99

86.6%
0.905

79.2%
0.368
32.2%
p n e p P
f
p n n
f
f f
small and large for ) 1 ( 1


Go-Back-N
Improve Stop-and-Wait by not waiting!
Keep channel busy by continuing to send frames
Allow a window of up to W
s
outstanding frames
Also uses sequence numbers
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
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 ARQ
A
B
fr
0
Time
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
3
A
C
K
1
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
R
next
0 1 2 3 3 4 5 6 7 8 9

Selective Repeat ARQ
Go-Back-N ARQ inefficient because multiple frames
are resent when errors or losses occur
Selective Repeat retransmits only an individual frame
Timeout causes individual corresponding frame to be resent
NAK causes retransmission of oldest un-acked frame
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 R
next
causes window to slide forward by
1 or more

A
B
fr
0
Time
fr
1
fr
2
fr
3
fr
4
fr
5
fr
6
fr
2
A
C
K
1
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
Selective Repeat ARQ
ARQ Efficiency Comparison
0
0.5
1
1.5
-9 -8 -7 -6 -5 -4 -3 -2 -1
- LOG(p)
E
f
f
i
c
i
e
n
c
y
Selective
Repeat
Go Back N 10
Stop and Wait
100
Go Back N 100
Stop and Wait
10
10
-9
10
-8
10
-7
10
-6
10
-5
10
-4
10
-3
10
-2
10
-1

p

Delay-Bandwidth product = 10, 100
ARQ Efficiencies

You might also like