0% found this document useful (0 votes)
9 views53 pages

2c Reliable Transmission

Uploaded by

ronaldodutra777
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)
9 views53 pages

2c Reliable Transmission

Uploaded by

ronaldodutra777
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/ 53

COMPSCI 311 – Computer Network Architecture

Reliable Transmission
Reliable transmission
• How to guarantee packets are delivered correctly?
• Frames may be corrupted or lost, error correction may be impossible
Reliable transmission
• How to guarantee packets are delivered correctly?
• Frames may be corrupted or lost, error correction may be impossible

• General approach: retransmit frames on failures


• An ACK (acknowledgement) confirms that a frame was received
• Frames are retransmitted if no ACK is received before a timeout
Reliable transmission
• How to guarantee packets are delivered correctly?
• Frames may be corrupted or lost, error correction may be impossible

• General approach: retransmit frames on failures


• An ACK (acknowledgement) confirms that a frame was received
• Frames are retransmitted if no ACK is received before a timeout

• Receiver detects error by checking an error-detecting code like CRC


• The sender detects the error by the absence of an ACK before the timeout
Stop-and-wait Sender
Fram
e
Receiver

transmission
Loop:
1. Send next frame
2. Wait for the ACK
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop:
1. Send next frame
2. Wait for the ACK
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


2. Wait for the ACK
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e

ACK
Fram
e

ACK
Fram
e

ACK
Fram
e
Stop-and-wait Sender
Fram
e
Receiver

transmission Timeout

Loop:
1. Send next frame
2. Wait for the ACK
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission Timeout

ACK
Loop:
1. Send next frame
2. Wait for the ACK
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Timeout
Fram
e

1. Send next frame


2. Wait for the ACK
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Timeout
Fram
e

1. Send next frame


ACK
2. Wait for the ACK
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e
Timeout
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e
Timeout
3. If ACK times out:
a. Continue with the same frame
4. If ACK arrives:
a. Continue with the next frame
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e
Timeout
3. If ACK times out:
a. Continue with the same frame
Fram
e
4. If ACK arrives: Timeout

a. Continue with the next frame


Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e

3. If ACK times out:


a. Continue with the same frame
Fram
e
4. If ACK arrives: Timeout

a. Continue with the next frame ACK


Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
Loop: Fram
e

1. Send next frame


ACK
2. Wait for the ACK Fram
e

3. If ACK times out:


a. Continue with the same frame
Fram
e
4. If ACK arrives:
a. Continue with the next frame ACK
Fram
e

ACK
Fram
e
Stop-and-wait Sender
Fram
e
Receiver

transmission
ACK
• We want a tight timeout Fram
e

• Not too long


ACK
• Waiting wastes bandwidth Fram
e
Timeout
• Not too short
• Spurious retransmission wastes
bandwidth Fram
e
Timeout
Stop-and-wait transmission
• Challenges with retransmissions

Early
No errors Retransmission Retransmission

Sender Receiver Sender Receiver Sender Receiver


Fram Fram Fram
e e e
Timeout Timeout
ACK
ACK ACK
Fram Fram
e Fram e
e
ACK
ACK
ACK
Stop-and-wait transmission
• Challenges with retransmissions

Early
No errors Retransmission Retransmission

Sender Receiver Sender Receiver Sender Receiver


Fram Fram Fram
e 1 e 1 e 1
Timeout Timeout
ACK
ACK ACK Fram
Fram e 1
e2 Fram
e 1
ACK
ACK
ACK
Sequence numbers
• Number each frame so we can identify each
• For stop-and-wait, a single bit (two frame identifiers) is enough
• ACKs must carry sequence number too
Early
No errors Retransmission Retransmission

Sender Receiver Sender Receiver Sender Receiver


Fram Fram Fram
e 1 e 1 e 1
Timeout Timeout
1
1 1 ACK
ACK ACK Fram
Fram e 1
e2 Fram
e 1
1
2 ACK
ACK 1
ACK
Stop-and-wait vs bandwidth-delay product
• Fast, long links can carry a lot of data
• Sending one frame at a time and waiting for ACK wastes bandwidth

(100ms each way)


Stop-and-wait vs bandwidth-delay product
• Fast, long links can carry a lot of data
• Sending one frame at a time and waiting for ACK wastes bandwidth
• Need to keep sending while waiting for ACKs

(100ms each way)


Endpoint 1 Endpoint 2

Continuous Transmission
time

transmission Propagation
delay

• Stop-and-wait is inefficient on
long high-bandwidth links

Time
Endpoint 1 Endpoint 2

Continuous Transmission
time

transmission Propagation
delay

• Stop-and-wait is inefficient on
long high-bandwidth links

Time
Endpoint 1 Endpoint 2

Continuous Transmission
time

transmission Propagation
delay

• Stop-and-wait is inefficient on
long high-bandwidth links
• Link is transmitting a small
fraction of the time

Time
Endpoint 1 Endpoint 2

Continuous 1

transmission
2
3
4
• Stop-and-wait is inefficient on 5

long high-bandwidth links 6


7
• Link is transmitting a small 8
fraction of the time 9
10
• Need to send multiple frames
while waiting for ACKs

Time
Endpoint 1 Endpoint 2

Continuous 1

transmission
2
3
4
• Stop-and-wait is inefficient on 5

long high-bandwidth links 6


7
• Link is transmitting a small 8
fraction of the time 9
10
• Need to send multiple frames
while waiting for ACKs
• In this example, need to send 10
frames without receiving an ACK

Time
Sliding window algorithm: sender
LAR LFS

• Send window size (SWS)


… …
• Last ACK received (LAR) ACK’d In flight Not yet sent
• Last frame sent (LFS) SWS = 7
Sliding window algorithm: sender
LAR LFS

• Send window size (SWS)


… …
• Last ACK received (LAR) ACK’d In flight Not yet sent
• Last frame sent (LFS) SWS = 7

Sliding window algorithm: receiver


LFR LFA

• Receive window size (RWS)


… …
• Largest frame acceptable (LFA) ACK’d Acceptable Not acceptable
• Last frame received (LFR) RWS = 7
Sliding window algorithm: sender
LAR LFS

• When ACK received:


• Move window forward
… …
ACK’d In flight Not yet sent
• Update LAR and LFS
SWS = 7
• Send next frames

Sliding window algorithm: receiver


LFR LFA

• When next frame received:


• Move window forward
… …
ACK’d Acceptable Not acceptable
• Update LFR and LFA
RWS = 7
• Send ACKs
Sliding window algorithm: sender
LAR LFS

• When timeout occurs:


• Retransmit whole window
… …
ACK’d In flight Not yet sent

SWS = 7

Sliding window algorithm: receiver


LFR LFA

• When next frame received:


• Move window forward
… …
ACK’d Acceptable Not acceptable
• Update LFR and LFA
RWS = 7
• Send ACKs
Transmission errors: Go-back-N
• Sender: retransmits whole window on timeout
• Receiver: ACKs whenever the next frame arrives
• Simple, but slow when errors occur
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … • Packets 6-12 in flight

ACK’d In flight Not yet sent

LFR LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
ACK’d Acceptable Not acceptable
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)

LFR LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)

LFR LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)

LFR LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), sends ack(7)
LFR • Frame 8 missing, window stuck
LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), sends ack(7)
LFR • Frame 8 missing, window stuck
LFA
• Sender gets ack(7), sends frame(14)

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: duplicate ACKs
• Sender: Retransmit a frame whenever a duplicate ACK is received
• Retransmit whole window on timeout
• Receiver: Send ACK for LFR whenever a frame arrives out of order
LAR LFS • Receiver gets frame(5), sends ack(5)
• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), sends ack(7)
LFR • Frame 8 missing, window stuck
LFA
• Sender gets ack(7), sends frame(14)

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … • Sender gets dupack(7), sends frame(8)


• Early retransmission may speed
up recovery from loss of frame(8)
Transmission errors: selective ACKs
• Sender: Retransmits missing frames
• Receiver: Send cumulative ACKs when possible, selective ACKs otherwise

LAR LFS • Receiver gets frame(5), sends ack(5)


• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), send sack(9)
LFR • Frame 8 missing, window stuck
LFA

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: selective ACKs
• Sender: Retransmits missing frames
• Receiver: Send cumulative ACKs when possible, selective ACKs otherwise

LAR LFS • Receiver gets frame(5), sends ack(5)


• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), send sack(9)
LFR • Frame 8 missing, window stuck
LFA
• Sender gets ack(7), sends frame(14)

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 …
Transmission errors: selective ACKs
• Sender: Retransmits missing frames
• Receiver: Send cumulative ACKs when possible, selective ACKs otherwise

LAR LFS • Receiver gets frame(5), sends ack(5)


• Sender gets ack(5)

Sender …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … •

Packets 6-12 in flight
Receiver gets frame(6), sends ack(6)
• Receiver gets frame(7), sends ack(7)
• Sender gets ack(6), sends frame(13)
• Receiver gets frame(9), send sack(9)
LFR • Frame 8 missing, window stuck
LFA
• Sender gets ack(7), sends frame(14)

Receiver …3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 … • Sender gets sack(9), sends frame(8)


• Sender knows exactly what
needs to be retransmitted
Sliding window and performance
• Goal: 100% link utilization
• How many packets should the sliding window have?
• We want to transmit 100% of the time until ACKs start arriving
Endpoint 1 Endpoint 2

Sliding window and performance


1
2
3
4
• Goal: 100% link utilization 5
6
• How many packets should the sliding window have? 7
• We want to transmit 100% of the time until ACKs start arriving 8
9
10

Time
Endpoint 1 Endpoint 2

Sliding window and performance


1
2
3
4
• Goal: 100% link utilization 5
6
• How many packets should the sliding window have? 7
• We want to transmit 100% of the time until ACKs start arriving 8
9
• TransmissionTime = FrameSize / Bandwidth 10
• TimeToFirstACK = TransmissionTime + RoundTripTime
• NumberOfPackets = ⌈ TimeToFirstACK / TransmissionTime ⌉

Time
How many frame identifiers?
• Frame identifiers are stored in the frame header
• Overhead
• The smaller the better

• Number of distinct identifiers must be at least SWS + RWS


How many frame identifiers?
0
Window Data
1
0123456 0
2
1234567 0 1
3
2345670 0 1 2
4
3456701 0 1 2 3
5
4567012 0 1 2 3 4
ACKs 6
received 5670123 0 1 2 3 4 5
7
6701234 0 1 2 3 4 5 6
0
7012345 0 1 2 3 4 5 6
1
7012345 0 1 2 3 4 5 6 0
Second window 2
transmitted 7012345 0 1 2 3 4 5 6 0 1
3
7012345 0 1 2 3 4 5 6 0 1 2
4
7012345 0 1 2 3 4 5 6 0 1 2 3
5
7012345 0 1 2 3 4 5 6 0 1 2 3 4
6
7012345 0 1 2 3 4 5 6 0 1 2 3 4 5
7012345 0 1 2 3 4 5 6 0 1 2 3 4 5
How many frame identifiers?
0
Window Data
1
0123456 0
2
1234567 0 1
3
2345670 0 1 2
4
3456701 0 1 2 3
5
4567012 0 1 2 3 4
All ACKs 6 Wrong
lost! 5670123 0 1 2 3 4 5 receptions!
7
6701234 0 1 2 3 4 5 6
0
7012345 0 1 2 3 4 5 6
1
First window 7012345 0 1 2 3 4 5 6 0
retransmitted 2
7012345 0 1 2 3 4 5 6 0 1
3
7012345 0 1 2 3 4 5 6 0 1 2
4
7012345 0 1 2 3 4 5 6 0 1 2 3
5
7012345 0 1 2 3 4 5 6 0 1 2 3 4
6
7012345 0 1 2 3 4 5 6 0 1 2 3 4 5
7012345 0 1 2 3 4 5 6 0 1 2 3 4 5
How many frame identifiers?
• Frame identifiers are stored in the frame header
• Overhead
• The smaller the better

• Number of distinct identifiers must be at least SWS + RWS


• Need to prevent overlap of sequence numbers between SWS and RWS
Alternative: Multiple channels
• An alternative to sliding windows is using multiple (slow) channels
• Frames are sent on one of many channels
• Each channel uses stop-and-wait
• We can generate many channels to fully utilize bandwidth
Alternative: Multiple channels
• An alternative to sliding windows is using multiple (slow) channels
• Frames are sent on one of many channels
• Each channel uses stop-and-wait
• We can generate many channels to fully utilize bandwidth

• Need to allocate channel to applications or flows


• Allocation may be challenging depending on application or flow properties

You might also like