Primitives for Achieving Reliability - PowerPoint PPT Presentation

1 / 56
About This Presentation
Title:

Primitives for Achieving Reliability

Description:

Primitives for Achieving Reliability 3035/GZ01 Networked Systems Kyle Jamieson Lecture 7 Department of Computer Science University College London – PowerPoint PPT presentation

Number of Views:128
Avg rating:3.0/5.0
Slides: 57
Provided by: Kyle142
Category:

less

Transcript and Presenter's Notes

Title: Primitives for Achieving Reliability


1
Primitives for Achieving Reliability
  • 3035/GZ01 Networked Systems
  • Kyle Jamieson
  • Lecture 7
  • Department of Computer Science
  • University College London

2
Achieving reliability the story so far
  1. Apply forward error correction (FEC) at physical
    layer
  2. Apply error detection at higher layers

3
Choosing the amount of FEC to apply
  • Adding parity bits
  • Increases number of bit
  • errors receiver can correct
  • Increases overhead
  • Reduces the bit error rate (BER) after error
    correction
  • Question What BER after error correction should
    we target?

4
How much FEC do we need to apply?
5
How much FEC? (notes)
  • What do we really care about? Keep frame loss
    rate (FLR) low 10-3
  • Suppose after applying FEC, probability of a bit
    error is BER
  • PrFrame of length n bits delivered (1 - BER)n
  • Assumption Independence between bit errors
    (worst case)
  • Frame loss rate (FLR) 1 - PrFrame delivered
  • Add enough FEC to keep FLR below rise, but no
    more (wastes bits on the channel)
  • Where is the rise, for a given packet size?
  • For small x, binomial expansion of (1x)n 1
    nx O(x2) 1 nx
  • FLR 1 - (1 - BER)n n (BER), therefore goal
    is to keep n (BER) lt 10-3
  • Therefore, for data packet of 1250 bytes (104
    bits), need BER after FEC of 10-7

6
Some errors are too severe to be corrected
  • No matter how many parity bits we add, the
    network could flip them and data bits, causing
    errors!
  • Error detection (CRC) then discards these frames
  • How to ensure that links are reliable?

7
Reliable delivery Plan
  • Goal ensure every packet is received exactly
    once
  • Exactly-once delivery
  • Pipelining for performance
  • Handling retransmissions intelligently
  • Congestion in the Internet
  • Culmination the Transmission Control Protocol

8
Today
  • Three protocols that achieve reliability
  • Designing reliable transfer from first
    principles the Stop and Wait protocol
  • Exploiting pipelining in the network Go Back N
  • Smarter error recovery Selective Repeat

9
Reliable transfer over an unreliable channel
  • Task Design sender and receiver sides of a
    reliable data transfer (rdt) protocol, using
    unreliable data transfer (udt) protocol
  • Recurs at many different layers
    transport/network, link/physical

rdt_send(data)
deliver_data(data)
Reliable data transfer protocol (sender side)
Reliable data transfer protocol (receiver side)
udt_send(pkt)
rdt_recv(pkt)
Unreliable channel
10
Approach
  • Lets derive a protocol that achieves reliable
    transfer from first principles
  • Goal exactly once, in-order delivery of every
    packet
  • Unidirectional at first same principles can
    generalize to bidirectional data transfer
  • Starting assumptions
  • Channel can not introduce bit errors into packets
  • Channel can not fail to deliver packets
  • Channel can not delay packets
  • Channel can not reorder packets
  • Gradually relax these assumptions, one by one

11
Reliable data transfer (rdt) v1.0
  • Independent state machines at sender, receiver
  • No need for feedback (underlying channel is
    reliable)
  • No flow control in this protocol

Sender state machine
Receiver state machine
12
Assumptions
  • Channel can introduce bit errors into packets
  • Channel (sender to receiver) can introduce bit
    errors
  • Channel (receiver to sender) can not introduce
    bit errors
  • Channel can not fail to deliver packets
  • Channel can not delay packets
  • Channel can not reorder packets

13
Idea Receiver requests re-sends
A loaf of bread,
OK.
A dozen eggs,
Sorry?
A dozen eggs,
  • Three fundamental mechanisms
  • Error detection typically a packet checksum
    (like the CRC)
  • Acknowledgements small control frame (ACK)
    transmitted from the receiver back to the sender
  • Positive ACKs acknowledge correct receipt
  • Negative ACKs inform sender of incorrect receipt
  • Timeouts sender waits a reasonable amount of
    time, then retransmits the frame
  • Protocols using these techniques are called
    automatic repeat request (ARQ) protocols
  • Surprisingly challenging to apply correctly!

14
Reliable data transfer under bit errors
rdt v2.0 sender state machine
rdt v2.0 receiver state machine
15
Reliable data transfer v2.0 analysis
Sender
Receiver
  • Stop-and-wait protocol Sender doesnt send more
    data until sure original data received
  • Performance depends on sender-receiver delay, and
    throughput
  • Correctness Two cases
  • Data arrives okay
  • ACK comes back immediately
  • Sender sends next packet
  • Data arrives corrupted
  • NACK comes back immediately
  • Sender retransmits corrupted packet
  • Exactly once, in-order delivery

IDLE
ACK wait
Data A
ACK
IDLE
ACK wait
Data B
NACK
IDLE
16
Assumptions
  • Channel can introduce bit errors into packets
  • Channel (sender to receiver) can introduce bit
    errors
  • Channel (receiver to sender) can introduce bit
    errors
  • Channel can not fail to deliver packets
  • Channel can not delay packets arbitrarily
  • Channel can not reorder packets

17
Human approach to feedback errors
A loaf of bread,
OK.
Sorry?
???
  • One possibility Apply ARQ in reverse
  • Request retransmits of corrupted feedback
  • If corrupt, receiver doesnt know if forward-link
    packets are data or feedback retransmit requests
  • Clearly heading down a difficult path!

18
Idea Add checksums to feedback
rdt v2.0 (with checksums) sender state machine
rdt v2.0 (with checksums) receiver state machine
19
Problem for rdt v2.0 duplicates
Sender
Receiver
  • Three cases
  • Data okay, ACK okay
  • Data corrupted
  • NACK comes back immediately
  • Sender retransmits corrupted data packet
  • Data okay, ACK corrupted
  • ACK comes back immediately
  • Sender retransmits an identical data packet
  • At least once, in-order delivery

IDLE
ACK wait
Data B
NACK
IDLE
ACK wait
Data B
ACK
IDLE
20
Assumptions
  • Channel can introduce bit errors into packets
  • Channel (sender to receiver) can introduce bit
    errors
  • Channel (receiver to sender) can introduce bit
    errors
  • Channel can not fail to deliver packets
  • Channel can not delay packets arbitrarily
  • Channel can not reorder packets
  • Sender or channel can duplicate packets

21
From at least once to exactly once
  • Idea add sequence numbers to data packets
  • Sequence number allows receiver to suppress
    duplicates

rdt v2.1 sender state machine
22
From at least once to exactly once
  • Two states at receiver one for expecting
    seqno1 the other for expecting seqno0

rdt v2.1 receiver state machine
23
rdt v2.1 error-free operation
  • Sender send data, wait for reply
  • Receiver deliver data, send ACK
  • Sender send next data, wait
  • Receiver deliver data, send ACK
  • Sender transition to Idle State 0

I1
I0
24
rdt v2.1 bit errors on the forward link
  • Sender send data, wait for reply
  • Receiver checksum fails NACK
  • Sender resend seqno0 data
  • Receiver deliver data send ACK
  • Sender transition to Idle State 1

Sender
Receiver
I0
DW 0
I1
25
rdt v2.1 bit errors on the reverse link
  • Sender send data, wait for reply
  • Receiver deliver data send ACK
  • Sender resend seqno0 data
  • Receiver dup. data resend ACK
  • Sender transition to Idle State 1

Sender
Receiver
I0
DW 0
I1
26
rdt v2.2 Getting rid of NACKs
  • rdt v2.1 used different packets in feedback
    direction (ACK, NACK)
  • Instead, we can add sequence numbers to ACKs
  • Sequence number in ACK corresponds to data it
    acknowledges

Sender
Receiver
I0
DW 0
I1
27
rdt v2.1 Dropped packets
  • Sender transmit data, wait for a reply from the
    receiver
  • Result Deadlock

Sender
Receiver
I0
DW 0
28
Assumptions
  • Channel can introduce bit errors into packets
  • Channel (sender to receiver) can introduce bit
    errors
  • Channel (receiver to sender) can introduce bit
    errors
  • Channel can fail to deliver packets
  • Channel can delay packets arbitrarily
  • Channel can not reorder packets
  • Sender or channel can duplicate packets

29
Retransmission timer breaks deadlock
  • rdt v3.0 sender state machine

30
rdt v3.0 receiver
  • rdt v3.0 receiver state machine

31
rdt v3.0 recovering lost packets
  • Sender send, start timer, wait/reply
  • Receiver deliver send ACK 0 (lost)
  • Sender timeout, resend, start timer
  • Receiver dup. data resend ACK 0
  • Sender stop timer, go to Idle State 1

Sender
Receiver
I0
DW 0
I1
32
rdt v3.0 delays in the network
  • Sender send, start timer, wait/reply
  • Receiver deliver send ACK (delayed)
  • Sender timeout, resend, start timer
  • Sender stop timer, go to Idle State 1
  • Receiver dup. data, resend ACK 0
  • Sender recv. dup. ACK 0, do nothing

Sender
Receiver
I0
DW 0
I1
I1
33
Stop-and-wait performance
Data packet size L bits, link bitrate R
bits/second
sender
receiver
Forward link utilization
34
Performance of stop-and-wait protocols
  • Packet size L, link bitrate R utilization
  • Internet e.g. 8000 bit packet 1 Gbit/s link, 30
    ms RTT
  • WiFi e.g. 8000 bit packet 54 Mbit/s link, 100
    ns RTT

(not including other unrelated overheads)
When packet time ltlt RTT, stop-and-wait
underperforms.
35
Idea Pipelined protocols
  • Pipelining sender allows multiple unacknowledged
    packets in-flight from sender to receiver
  • Range of sequence numbers must be increased
  • Buffering at sender and/or receiver
  • Two generic forms of pipelined protocols
  • Go-Back-N, Selective Repeat

36
Increasing utilization with pipelining
37
The bandwidth-delay product
  • How many packets N should we allow in flight
    (unacknowledged) in order to get maximum link
    utilization?

Number of bits in flight
Delay Bandwidth product
38
Today
  • Three protocols that achieve reliability
  • Designing reliable transfer from first
    principles the Stop and Wait protocol
  • Exploiting pipelining in the network Go Back N
  • Smarter error recovery Selective Repeat

39
Assumptions
  • Channel can introduce bit errors into packets
  • Channel (sender to receiver) can introduce bit
    errors
  • Channel (receiver to sender) can introduce bit
    errors
  • Channel can fail to deliver packets
  • Channel can delay packets arbitrarily
  • Channel can reorder packets in forward direction
  • Sender or channel can duplicate packets

40
The Go-Back-N (GBN) protocol
  • Sender send without waiting for an
    acknowledgement
  • Up to N unacked packets in flight at any time
  • Why limit to N? Flow control at receiver,
    congestion control in the network
  • Timer for oldest unacknowledged packet
  • Timer expire retransmit all unacknowledged
    packets (sender can go back up to N packets)
  • Receiver sends cumulative acknowledgement
    acknowledge receipt of all packets up to and
    including packet n ACK(n)

41
GBN at the sender
  • GBN A type of Sliding Window Protocol
  • rdt_send(data)
  • if nextseqnum lt send_base N
  • sndpktnextseqnum make_pkt
  • send data with nextseqnum
  • nextseqnum
  • else
  • (refuse data)
  • timeout
  • send(sndpktbase)
  • send(sndpktbase1)
  • send(sndpktnextseqnum-1)
  • rdt_recv(ackpkt)
  • send_base ackpkt.seqno 1

(Timer code not shown)
42
GBN at the receiver
  • Maintain expectedseqnum variable sequence number
    of the next in-order packet
  • send_base expectedseqnum lt nextseqnum
  • Incoming data packet with seqnon
  • n expectedseqnum send ACK(n), increment
    expectedseqnum
  • n ltgt expectedseqnum discard packet, send
    ACK(expectedseqnum - 1)
  • Nothing more, because in the event of loss, the
    sender will go back to expectedseqnum!
  • Could buffer correctly-received out-of-order
    packets, but the sender will transmit them later
    anyway

43
GBN (N 4) in operation
Sender
Receiver
44
The role of the retransmission timer
  • Keeps track of time at sender since the oldest
    unacknowledged packet was sent
  • This is the packet at the left edge of the
    senders window
  • Issue Choosing a reasonable timer value
  • Compare to RTT of one packet
  • Too small causes unnecessary retransmissions
  • Too big wastes time
  • Later we will see how TCP solves this problem
    robustly

45
Today
  • Three protocols that achieve reliability
  • Designing reliable transfer from first
    principles the Stop and Wait protocol
  • Exploiting pipelining in the network Go Back N
  • Smarter error recovery Selective Repeat

46
Selective Repeat Introduction
  • Go Back N
  • Allows sender to fill pipeline with packets, for
    high channel utilization
  • Receiver sends cumulative acknowledgements ACK(n)
    acknowledging packet n and all those before
  • Large pipeline means that a single packet error
    results in many duplicate packet transmissions
  • Selective Repeat (SR)
  • Main idea sender retransmits only packets that
    dont reach the receiver correctly
  • Receiver individually acknowledges each packet
  • One retransmission timer per packet
  • GBN and SR are both examples of sliding window
    protocols

47
Finite sequence number space
  • Used in practice for both GBN and SR
  • Sequence numbers
  • k-bit sequence number
  • Result a sequence number space in the range 0,
    2k-1
  • All arithmetic is modulo 2k wrap-around from end
    to beginning

48
Selective Repeat Sequence numbers
nextseqnum
send_base
Senders view
Window size N
rcv_base
Receivers view
Window size N
  • Window size N limits number of unacked packets in
    pipeline
  • send_base lowest unacked packet
  • nextseqnum last sent packet sequence number,
    plus 1
  • rcv_base last frame delivered, plus 1

49
SR sender Data received from above
send_base
nextseqnum
Senders view
Window size N
rcv_base
Receivers view
Window size N
  • Sender checks nextseqnum
  • If in sender window, transmit, increment
    nextseqnum by one
  • If not in sender window, refuse data from above

50
SR sender Timeout event
send_base
nextseqnum
Senders view
Window size N
rcv_base
Receivers view
Window size N
  • Recall each packet has its own retransmission
    timer
  • Only packets timers in send window will be
    active
  • Sender retransmits packet then restarts that
    packets timer

51
SR receiver packet reception
send_base
nextseqnum
Senders view
Window size N
rcv_base
Receivers view
rcv_base - N, rcv_base - 1
rcv_base, rcv_base N - 1
  • Correct packet reception with received seqno r.
    Three cases
  • seqno r in receiver window deliver data, send
    ACK, advance window
  • seqno r in rcv_base - N, rcv_base - 1 resend
    ACK
  • Otherwise ignore the packet

52
SR sender ACK received
send_base
nextseqnum
Senders view
rcv_base
Receivers view
Window size N
  • Sender marks packet as already ACKed, stops
    retransmit timer
  • Sender compares send_base and ACK sequence
    number
  • If ACK is not for send_base, keep window where it
    is
  • If ACK is for send_base, advance send_base and
    send window by one

53
SR (N 4) in operation
Sender
Receiver
Send packet 0 0 1 2 3 4 5 6 7 8 9 Send packet
1 0 1 2 3 4 5 6 7 8 9 Send packet 2 0 1 2 3 4
5 6 7 8 9 Send packet 3 0 1 2 3 4 5 6 7 8
9 Recv ACK 0, send 4 0 1 2 3 4 5 6 7 8 9 Recv
ACK 1, send 5 0 1 2 3 4 5 6 7 8 9 Timeout 2,
resend 2 0 1 2 3 4 5 6 7 8 9 Recv ACK 3, send
- 0 1 2 3 4 5 6 7 8 9
Recv 0, deliver, ACK 0 0 1 2 3 4 5 6 7 8 9 Recv
1, deliver, ACK 1 0 1 2 3 4 5 6 7 8 9 Recv 3,
buffer, ACK 3 0 1 2 3 4 5 6 7 8 9 Recv 4,
buffer, ACK 4 0 1 2 3 4 5 6 7 8 9 Recv 5,
buffer, ACK 5 0 1 2 3 4 5 6 7 8 9 Recv 2,
deliver 2-5, ACK 2 0 1 2 3 4 5 6 7 8 9
54
Window size vs sequence number spaceN 3, k2
(4 sequence numbers)
Sender
Receiver
Send 0 0 1 2 3 0 1 2 Send 1 0 1 2 3 0 1
2 Send 2 0 1 2 3 0 1 2 Timeout, resend 0
Recv 0, deliver, ACK 0 0 1 2 3 0 1 2 Recv 1,
deliver, ACK 1 0 1 2 3 0 1 2 Recv 0 ?
suppress duplicate
Send 0 0 1 2 3 0 1 2 Send 1 0 1 2 3 0 1
2 Send 2 0 1 2 3 0 1 2 Recv ACK 0, send 3 0 1
2 3 0 1 2 Recv ACK 1, send 0 0 1 2 3 0 1 2 3
Recv 0, deliver, ACK 0 0 1 2 3 0 1 2 Recv 1,
deliver, ACK 1 0 1 2 3 0 1 2 Recv 0 ?
deliver up
55
Window size vs sequence number space
send_base
Senders view
rcv_base
Receivers view
Window size N
  • N gt 2k-1 window too large
  • Right edge of receivers window can wrap past
    left edge of senders window
  • N 2k-1 no overlap

56
Next time
  • Introduction to Internetworking
  • Pre-Reading P D, Sections 3.2 and 4.1
Write a Comment
User Comments (0)
About PowerShow.com