Reliable Transport 14-740: Fundamentals of Computer Networks Bill - - PowerPoint PPT Presentation

reliable transport
SMART_READER_LITE
LIVE PREVIEW

Reliable Transport 14-740: Fundamentals of Computer Networks Bill - - PowerPoint PPT Presentation

Reliable Transport 14-740: Fundamentals of Computer Networks Bill Nace Material from Computer Networking: A Top Down Approach. J.F. Kurose and K.W. Ross Administration Stu ff is due HW #1 was due 2 slides ago Lab #1 on Tuesday


slide-1
SLIDE 1

Material from Computer Networking: A Top Down Approach. J.F. Kurose and K.W. Ross

Reliable Transport

14-740: Fundamentals of Computer Networks Bill Nace

slide-2
SLIDE 2

Administration

  • Stuff is due
  • HW #1 was due 2 slides ago
  • Lab #1 on Tuesday
  • Quiz #1 regrade requests due Wednesday
  • No class on Thursday

2

slide-3
SLIDE 3

Last Lecture

  • Transport Layer
  • Mission: Logical connection, App ↔ App
  • Tools: {De}Multiplex ➙ Port Numbers
  • Segmentation
  • UDP
  • Simple segment blaster

3

slide-4
SLIDE 4

traceroute

  • RDT Theory and Tools
  • Stop-and-wait Protocol
  • Motivates Pipelining
  • Sliding-window Protocols
  • Go-back-N (GBN)
  • Selective Repeat (SR)

4

slide-5
SLIDE 5

RDT: Requirements

  • Reliable Data Transfer (RDT)
  • Reliable channel service abstraction
  • No transferred bits are corrupted
  • All bits are delivered (and no extras) ...
  • ... in the order sent
  • Generally bidirectional
  • Today, we talk about unidirectional

5

slide-6
SLIDE 6

Fault Models

  • Network-layer may have faults
  • Bit-errors
  • Lossy: i.e. segment can go missing
  • Duplicate delivery
  • Out-of-order delivery

6

slide-7
SLIDE 7

Tools

  • Receiver feedback
  • Positive acknowledgement (ACK)
  • Good segment received
  • Negative acknowledgement (NAK)
  • Bad segment received

7

slide-8
SLIDE 8

Tools (2)

  • Error detection
  • Checksum -- Segment received, but bit

errors exist

  • Timer expiration -- Segment or receiver

feedback is lost

8

slide-9
SLIDE 9

Tools (3)

  • Retransmission
  • Sender sends another copy of segment
  • Sequence number
  • Distinguish between old and new
  • Gaps let receiver detect lost segment
  • Window, pipelining
  • Control sending of multiple segments

9

slide-10
SLIDE 10

traceroute

  • RDT Theory and Tools
  • Stop-and-wait Protocol
  • Motivates Pipelining
  • Sliding-window Protocols
  • Go-back-N (GBN)
  • Selective Repeat (SR)

10

slide-11
SLIDE 11

Stop-and-wait

  • Simplest Protocol that will handle bit

errors and segment loss

  • Example of how to use:
  • checksum
  • acknowledgement
  • sequence numbers (1 bit)
  • timers

11

slide-12
SLIDE 12

The protocol (v1)

  • After sending a segment
  • Wait to get an ACK/NAK
  • If NAK, resend the

segment

  • Then go back to waiting
  • If ACK, great!
  • When segment is received
  • Examine checksum
  • Reply with ACK for good

segment

  • Deliver to App layer
  • NAK for corrupted ones
  • Tools used: Checksum, ACK and NAK
  • Protocol does not create duplicate segments
slide-13
SLIDE 13

Stop-and-wait in Action

  • Version 1
  • Checksum: Detects

flipped bits

  • ACK / NAK: Feedback
  • “segment is good”
  • “segment is damaged”

13

Sender Receiver send segment rcv segment send NAK rcv NAK send segment rcv segment send ACK rcv ACK

slide-14
SLIDE 14

The protocol (v2)

  • When sending a segment
  • seq # = 1 - last seq #
  • Wait to get ACK/NAK
  • If corrupted or NAK,

resend

  • Otherwise, great!
  • When segment is received
  • Reply with ACK if good
  • NAK for corrupted ones
  • Include seq number
  • If seq # is ≠ last seq #
  • Deliver to App Layer
  • Tools used: Cksm, ACK/NAK, 1-bit seq number
  • Protocol retransmits a damaged ACK/NAK
  • ... but it can lose a segment
slide-15
SLIDE 15

Stop-and-wait in Action

  • Version 2
  • Checksum: Detects

flipped bits in segment

  • r ACK / NAK
  • Sequence Number:

Detects duplicate segments

15

Sender Receiver send seg0 rcv seg0 send NAK rcv NAK send seg0 rcv seg0 send ACK deliver to App rcv ACK send seg1 rcv seg1 send ACK deliver to App rcv ACK send seg1 rcv seg1 send ACK rcv ACK

Duplicate! Not delivered to App layer

slide-16
SLIDE 16

The protocol (v3)

  • When sending a segment, set

timer, include seq number

  • When ACK received, remove

timer and proceed with next segment

  • NAK: reset timer, resend
  • If timer goes off, resend (and

set the timer)

  • When segment is received
  • ACK for good segments
  • NAK for corrupted ones
  • Include seq number
  • If seq # is ≠ last seq #
  • Deliver to App Layer
  • Tools used: Cksm, ACK/NAK, seq numbers, timers
  • Protocol retransmits lost segments
slide-17
SLIDE 17

Stop-and-wait in Action

Lost Segment Operation with no loss

Sender Receiver send seg0 rcv seg0 send ACK0 rcv ACK0 send seg1 rcv seg1 send ACK1 rcv seg0 send ACK0 rcv ACK1 send seg0 Sender Receiver send seg0 rcv seg0 send ACK0 rcv ACK0 send seg1 rcv seg1 send ACK1 rcv seg0 send ACK0 rcv ACK1 send seg0 timeout timeout resend seg1

slide-18
SLIDE 18

Sequence Numbers

Lost ACK

  • Without sequence

numbers, receiver doesn’t know if retransmitted segment is new data or old

  • Lost ACK and Lost

Segment are identical to sender

Sender Receiver send seg0 rcv seg0 send ACK0 rcv ACK0 send seg1 rcv seg1 send ACK1 rcv seg0 send ACK0 rcv ACK1 send seg0 timeout timeout resend seg1 rcv seg1 send ACK1

slide-19
SLIDE 19

Sequence Numbers (2)

Premature Timeout

  • Sender can’t distinguish

first and second ACK1

  • Sequence number

indicates duplicate

  • Sender waiting for ACK0
  • Does nothing on ACK1

Sender Receiver send seg0 rcv seg0 send ACK0 rcv ACK0 send seg1 rcv seg1 send ACK1 rcv seg0 send ACK0 rcv ACK1 send seg0 timeout timeout resend seg1 rcv seg1 send ACK1 rcv ACK1 do nothing

slide-20
SLIDE 20

Stop-and-wait has a problem

L = 1000B segment R = 1.5Mbps RTT = 45 ms

Usender =

L / R = .0053 = 0.1059 L / R + RTT .0503

Blech!

Sender Receiver

first segment bit transmitted, t=0 last segment bit transmitted, t = L / R RTT ACK arrives. First bit of next segment, t = RTT + L / R first segment bit arrives last segment bit arrives, send ACK

slide-21
SLIDE 21

How can U be One?

  • Bandwidth-Delay Product
  • Amount of data that could be in transit
  • Sender could pump this much data without

awaiting an ACK

  • Example
  • RTT = 45ms, R = 1.5Mbps
  • BWxDelay = R x RTT = 67.5Kb
  • If L = 1KB, (i.e. 8Kb) 8 segments could be

in flight

21

slide-22
SLIDE 22

Pipelined Protocols

  • Pipelining: send multiple, “in-flight”, yet-

to-be-acknowledged segments

22

A stop-and-wait protocol A pipelined protocol

Data segment Data segments ACK segments

slide-23
SLIDE 23

Pipelining: Increased Utilization

23

Usender =

3 x L / R = 0.016 = 0.317 L / R + RTT .0503

Increased utilization by a factor of 3!

Sender Receiver

first segment bit transmitted, t=0 last segment bit transmitted, t = L / R RTT ACK arrives. First bit of next segment, t = RTT + L / R first segment bit arrives last segment bit arrives, send ACK last bit of 2nd seg arrives, send ACK last bit of 3rd seg arrives, send ACK

slide-24
SLIDE 24

traceroute

  • RDT Theory and Tools
  • Stop-and-wait Protocol
  • Motivates Pipelining
  • Sliding-window Protocols
  • Go-back-N (GBN)
  • Selective Repeat (SR)

24

slide-25
SLIDE 25

Sliding-window Protocols

  • A mechanism to control multiple, in-flight

segments without overwhelming receiver

  • Sender is allowed to transmit N segments

without waiting for an ACK

  • N is the window size, a range of permissible

sequence numbers

  • Two generic forms
  • Go-Back-N (GBN)
  • Selective Repeat (SR)

25

slide-26
SLIDE 26

GBN: Sender

  • Sender places a k-bit seq# in header
  • “window” of up to N, consecutive unACKed

segments allowed

  • Sets a timer for each in-flight segment
  • timeout(n): retransmit segment n and all higher

seq# segments in window

  • ACK(n): ACKs all segments up to, including

seq# n

  • Cumulative ACK

26

slide-27
SLIDE 27

GBN: Receiver

  • ACK-only: always send ACK for

correctly-received segment with highest in-order seq#

  • May generate duplicate ACKs
  • But, only remembers expected seq#
  • Receipt of out-of-order segment:
  • Discard! No receiver side buffering
  • Re-ACK seg with highest in-order seq#

27

slide-28
SLIDE 28
  • Sender variables: send_base, nextseqnum
  • As segs are ACK’ed, window slides to right
  • GBN is a sliding-window protocol

GBN: Window

send_base nextseqnum window size (N)

already ACK'ed sent, not yet ACK'ed usable, not yet sent not usable

slide-29
SLIDE 29
  • N = ?
  • sendbase?
  • next_seqnum?

GBN in Action

29

Sender Receiver

X

rcv seg0 send ACK0 rcv seg3 (discard) send ACK1 rcv seg1 send ACK1 rcv seg4 (discard) send ACK1 rcv seg5 (discard) send ACK1 rcv seg2 (deliver) send ACK2 rcv seg3 (deliver) send ACK3 send seg0 rcv ACK0 send seg4 seg2 timeout resend seg2 send seg1 send seg2 send seg3 rcv ACK1 send seg5 wait resend seg3 resend seg4 resend seg5

slide-30
SLIDE 30

The Good, Bad, Ugly

  • GBN has minimal state at ends
  • especially receiver
  • Why discard segs received out-of-order?
  • Don’t want to buffer them, going to be

re-sent anyway

  • Ugly: A single segment error can cause

many segments to be retransmitted

30

slide-31
SLIDE 31

traceroute

  • RDT Theory and Tools
  • Stop-and-wait Protocol
  • Motivates Pipelining
  • Sliding-window Protocols
  • Go-back-N (GBN)
  • Selective Repeat (SR)

31

slide-32
SLIDE 32

Selective Repeat

  • Receiver individually ACKs all correctly

received segments

  • Buffers segs for eventual in-order delivery
  • Sender only resends segments for which

ACK not received

  • Sets timer for each segment
  • Sender window of N consecutive seq#s
  • Limits seq#s of sent, but unACKed segs

32

slide-33
SLIDE 33

SR: Windows

send_base nextseqnum window size (N)

already ACK'ed sent, not yet ACK'ed usable, not yet sent not usable

rcv_base window size (N)

already received acceptable (within window) buffered and ACK'ed (out of order) not usable

Sender Receiver A different view of the situation!

slide-34
SLIDE 34

SR Details

  • Data from app-layer
  • if next_seqnum in window,

send segment, start timer

  • else buffer
  • timeout (n)
  • resend seg n, restart timer
  • ACK(n) in window
  • mark seg n as received
  • if n is smallest unACKed seg,

send_base = next unACKed seq#

  • Seg(n) in receive window
  • send ACK(n)
  • if out-of-order: buffer
  • if in-order: deliver all buffered,

in-order segs and advance window to not-yet-received segment

  • Seg(n) in [rcvbase-N, rcvbase-1]
  • send ACK(n)
  • other pkt
  • ignore

Sender Receiver

slide-35
SLIDE 35

SR at work

Sender Receiver

X

seg0 sent 0 1 2 3 4 5 6 7 0 1 2 3 seg1 sent 0 1 2 3 4 5 6 7 0 1 2 3 seg2 sent 0 1 2 3 4 5 6 7 0 1 2 3 seg3 sent 0 1 2 3 4 5 6 7 0 1 2 3 (window full, wait) ACK0 rcvd, seg4 sent 0 1 2 3 4 5 6 7 1 2 3 4 ACK1 rcvd, seg5 sent 0 1 2 3 4 5 6 7 2 3 4 5 seg2 timeout, seg2 resent 0 1 2 3 4 5 6 7 2 3 4 5 ACK 3 rcvd, nothing sent 0 1 2 3 4 5 6 7 2 3 4 5 seg0 rcvd, delivered, ACK0 sent 0 1 2 3 4 5 6 7 8 9 1 2 3 4 seg1 rcvd, delivered, ACK1 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg3 rcvd, buffered, ACK3 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg4 rcvd, buffered, ACK4 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg5 rcvd, buffered, ACK5 sent 0 1 2 3 4 5 6 7 8 9 2 3 4 5 seg2 rcvd, ACK2 sent seg2, seg3, seg4, seg5 delivered 0 1 2 3 4 5 6 7 8 9 6 7 8 9

slide-36
SLIDE 36

SR Issues

  • Both sides often have

varying view

  • Ex: N=3 seq# 0,1,2,3
  • Two scenarios
  • Receiver side is same
  • Will deliver duplicate

data in 1st case

  • Seq# space is too small

0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 1 2 3 0 1 2 3 0 1 2 2 3 0 0 1 2 3 0 1 2 3 0 1 0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 0 1 2 seg0 seg1 seg2 timeout retransmit seg0 s e g receive segment with seq# 0 ACK0 A C K 1 A C K 2

X X X

seg3 0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 1 2 3 0 1 2 3 0 1 2 2 3 0 0 1 2 3 0 1 2 3 0 1 0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 0 1 2 0 1 2 3 0 1 2 2 3 0 seg0 seg1 s e g 2 seg0 receive segment with seq# 0 A C K A C K 1 ACK2

X

0 1 2 3 0 1 2 1 2 3

slide-37
SLIDE 37
  • Seq# space (2k) must be at least twice as

large as the window size

  • Sender window and receiver window

must both fit in seq# space

Seq# space

m-w m-1 window (w)

already ACK'ed sent, not yet ACK'ed not usable

m-w window (w)

already received acceptable (within window) received and ACK'ed

m-1 m m+w-1

Sender Receiver

slide-38
SLIDE 38

Applets

  • Play and experiment
  • GBN and SR protocols
  • plus others from rest of the course
  • Available at textbook website:
  • http://wps.pearsoned.com/

ecs_kurose_compnetw_6/216/55463/14198702.cw/content/ index.html

slide-39
SLIDE 39

Tools Summary

  • ACK / NAK
  • Provides feedback from receiver
  • Can also get lost

39

slide-40
SLIDE 40

Tools Summary (2)

  • Retransmission Timer
  • Detects loss (sent data or ACK / NAK)
  • Allows for duplicate segments

40

slide-41
SLIDE 41

Tools Summary (3)

  • Sequence Numbers
  • Allows detection of duplicate segments
  • Have to be a bounded # bits

41

slide-42
SLIDE 42

Tools Summary (4)

  • Sliding windows
  • Allow for reuse of sequence numbers
  • Also allow for pipelining segments
  • Some variety in how this tool is

deployed

42

slide-43
SLIDE 43

Lesson Objectives

  • Now, you should be able to:
  • describe the purpose, limitations and variations in

usage of each RDT tool—checksums, receiver feedback, retransmission, sequence numbers, timer expiration, window—as well as the network faults each is designed to overcome

  • describe and analyze RDT protocols (including Stop-n-

Wait, Go Back N & Selective Repeat) in order to show how each RDT tool is employed

  • describe how changes to the employment scenario for

a protocol affects the protocol design choices. An example is receiver-side buffering

43