PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1...

20
CSC 401 Data and Computer Communications Networks Transport Layer Prof. Lina Battestilli Fall 2017 Pipelined Reliable Data Transfer Protocols: Go-Back-N and Selective Repeat Sec 3.4.2-3.4.3

Transcript of PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1...

Page 1: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

CSC 401Data and Computer Communications Networks

Transport Layer

Prof. Lina BattestilliFall 2017

Pipelined Reliable Data Transfer Protocols:Go-Back-N and Selective Repeat

Sec 3.4.2-3.4.3

Page 2: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Chapter 3 Outline

3.1 Transport-layer Services

3.2 Multiplexing and Demultiplexing

3.3 Connectionless Transport: UDP

3.4 Principles of Reliable Data Transfer

– building an rdt protocol

– pipelined rdt protocols: GBN, SR

3.5 Connection-oriented Transport: TCP

3.6 Principles of Congestion Control

3.7 TCP Congestion Control

Transport Layer

Page 3: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Performance of rdt3.0

• e.g.: 1 Gbps link, 15ms one-way prop. delay, 30msec RTT, 8000 bit packet:

U sender: utilization – fraction of time sender busy sending

U sender =

.008

30.008 = 0.00027

L / R

RTT + L / R =

267Kbps throughput over 1 Gbps link

Dtrans =LR

8000 bits

10 9 bits/sec= = 8 microsecs

stop&wait network protocol limits use of physical resources!

rdt3.0 is correct, but performance not so great

Page 4: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

rdt3.0: stop-and-wait operation

11

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arrives

last packet bit arrives, send ACK

ACK arrives, send next

packet, t = RTT + L / R

U sender =

.008

30.008 = 0.00027

L / R

RTT + L / R =

Utilization: fraction of time the sender is busy sending bits into the channel

Page 5: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Pipelined protocols

pipelining: sender allows multiple, “in-flight”,

yet-to-be-acknowledged packets

two generic forms of pipelined protocols: go-Back-N, selective repeat

Page 6: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Pipelining: increased utilization

13

first packet bit transmitted, t = 0

sender receiver

RTT

last bit transmitted, t = L / R

first packet bit arrives

last packet bit arrives, send ACK

ACK arrives, send next

packet, t = RTT + L / R

last bit of 2nd packet arrives, send ACKlast bit of 3rd packet arrives, send ACK

3-packet pipelining increases

utilization by a factor of 3!

U sender =

.0024

30.008 = 0.00081

3L / R

RTT + L / R =

How fast can you send? Is there a limit?

Page 7: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Consequences of Pipelining

14

• Range of sequence numbers must be increased • Sender and receiver may have to buffer packets

• At minimum the sender must have a buffer of packets that have been transmitted but not yet acknowledged

Go-back-N Selective Repeat

These two approaches differ on how they respond to lost, corrupted &overly-delayed packets

Page 8: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

• sender can have up to N unacked packets in pipeline

• receiver only sends cumulative ack– doesn’t ack packet if

there’s a gap

• sender has timer for oldest unacked packet– when timer expires,

retransmit all unackedpackets

• sender can have up to N unack’ed packets in pipeline

• receiver sends individual ack for each packet

• sender maintains timer for each unacked packet– when timer expires,

retransmit only that unacked packet

Pipelined protocols: Overview

Go-back-N Selective Repeat

Any advantages of cumulative ACKs?

Page 9: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Go-Back-N:

16

• k-bit seq # in pkt header – range [0, 2𝑘 − 1]

• “window” of up to N, consecutive unack’ed pkts allowed

– window slides forward over the sequence number space

– “sliding window protocol”

base -- sequence number of oldest unacknowledged packetnextseqnum – smallest unused sequence number , i.e. next new packet that can be sent

• ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”

• timer for oldest transmitted not acknowledged pkt

• timeout(n): retransmit packet n and ALL higher seq # pkts in window

sender

Page 10: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

GBN: extended FSM

17

Waitstart_timer

udt_send(sndpkt[base])

udt_send(sndpkt[base+1])

udt_send(sndpkt[nextseqnum-1])

timeout

rdt_send(data)

if (nextseqnum < base+N) {

sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)

udt_send(sndpkt[nextseqnum])

if (base == nextseqnum)

start_timer

nextseqnum++

}

else

refuse_data(data)

base = getacknum(rcvpkt)+1

If (base == nextseqnum)

stop_timer

else

start_timer

rdt_rcv(rcvpkt) &&

notcorrupt(rcvpkt)

base=1

nextseqnum=1

rdt_rcv(rcvpkt)

&& corrupt(rcvpkt)

L

L

Event:Data from app received

window is full

window is NOT full

Event: Timeoutsend all the already transmitted but un-Acked packets. This is where the name of this protocol comes from.

Event: GOOD Case, Receipt of a CumulativeACK

sender

Page 11: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

GBN: extended FSM

18

• Send ACK for correctly-received pkt with highest in-order seq #

– may generate duplicate ACKs

– need only remember expectedseqnum

• Out-of-order pkt received:

– discard (don’t buffer): no receiver buffering!

– re-ACK pkt with highest in-order seq #

Wait

udt_send(sndpkt)

default

rdt_rcv(rcvpkt)

&& notcurrupt(rcvpkt)

&& hasseqnum(rcvpkt,expectedseqnum)

extract(rcvpkt,data)

deliver_data(data)

sndpkt = make_pkt(expectedseqnum,ACK,chksum)

udt_send(sndpkt)

expectedseqnum++

expectedseqnum=1

sndpkt =

make_pkt(expectedseqnum,ACK,chksum)

LEvent: GOOD case, received the packets in order

Event: Out-of-order packet receiveddiscards it and resends an ACK for the most recently received packet

simple receiver … but are there any disadvantages?

receiver

Page 12: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

GBN in action

19

send pkt0send pkt1send pkt2send pkt3

(wait)

sender receiver

receive pkt0, send ack0receive pkt1, send ack1

receive pkt3, discard, (re)send ack1rcv ack0, send pkt4

rcv ack1, send pkt5

pkt 2 timeoutsend pkt2send pkt3send pkt4send pkt5

Xloss

receive pkt4, discard, (re)send ack1

receive pkt5, discard, (re)send ack1

rcv pkt2, deliver, send ack2rcv pkt3, deliver, send ack3rcv pkt4, deliver, send ack4rcv pkt5, deliver, send ack5

ignore duplicate ACK

0 1 2 3 4 5 6 7 8

sender window (N=4)

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/cw/content/interactiveanimations/go-back-n-protocol/index.html

Page 13: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Performance of GBN

20

• GBN has sequence numbers, cumulative ACKs, checksums, and timeout/retransmit – we will see these in TCP as well

• It can potentially “fill the pipeline” with packets

If Window size or Bandwidth-Delay product are very large (i.e.many pkts in pipeline) a single pkt error – results in lots of retransmissions

It could suffer performance problems:

Page 14: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Selective Repeat

• receiver individually acknowledges all correctly received pkts– buffers pkts, as needed, for eventual in-order delivery

to upper layer

• sender only resends pkts for which ACK not received– sender timer for each unACKed pkt

• sender window– N consecutive seq #’s

– limits seq #s of sent, unACKed pkts

-21

Page 15: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Selective Repeat: sender, receiver windows

22

Page 16: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Selective Repeat - psudocode

23

data from above:• if next available seq # in window,

send pkt

timeout(n):• resend pkt n, restart its timer

ACK(n) in [send_base,send_base+N-1]:

• mark pkt n as received

• if n was the smallest unACKed pkt, advance window start at next unACKed seq #

pkt n in [rcv_base, rcv_base+N-1]

• send ACK(n)

• out-of-order: buffer

• in-order: deliver (also deliver other buffered, in-order pkts), advance window to next not-yet-received pkt

pkt n in [rcv-base-N,rcv-base-1]

• Send ACK(n):receiver must have not gotten the previous ACK

otherwise:• ignore

[rcv-base-N to rcv-base-1]

sender receiver

Page 17: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Selective Repeat in action

24

send pkt0send pkt1send pkt2send pkt3

(wait)

sender receiver

receive pkt0, send ack0receive pkt1, send ack1

receive pkt3, buffer, send ack3rcv ack0, send pkt4

rcv ack1, send pkt5

pkt 2 timeoutsend pkt2

Xloss

receive pkt4, buffer, send ack4

receive pkt5, buffer, send ack5

rcv pkt2; deliver pkt2,pkt3, pkt4, pkt5; send ack2

record ack3 arrived

0 1 2 3 4 5 6 7 8

sender window (N=4)

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

0 1 2 3 4 5 6 7 8

record ack4 arrived

record ack5 arrived

Q: what happens when ack2

arrives?https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/cw/content/interactiveanimations/selective-repeat-protocol/index.html

Page 18: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Selective Repeat: dilemma

25

example: • seq #’s space: 0, 1, 2, 3• Window Size=3

• receiver sees no difference in two scenarios!

• duplicate data accepted as new in (b)

Q: what relationship between seq # size and window size to avoid problem in (b)?

receiver window(after receipt)

sender window(after receipt)

0 1 2 3 0 1 2

0 1 2 3 0 1 2

0 1 2 3 0 1 2

pkt0

pkt1

pkt2

0 1 2 3 0 1 2 pkt0

timeoutretransmit pkt0

0 1 2 3 0 1 2

0 1 2 3 0 1 2

0 1 2 3 0 1 2X

X

X

will accept packetwith seq number 0

(b) oops!

0 1 2 3 0 1 2

0 1 2 3 0 1 2

0 1 2 3 0 1 2

pkt0

pkt1

pkt2

0 1 2 3 0 1 2

pkt0

0 1 2 3 0 1 2

0 1 2 3 0 1 2

0 1 2 3 0 1 2

X

will accept packetwith seq number 0

0 1 2 3 0 1 2 pkt3

(a) no problem

receiver can’t see sender side.receiver behavior identical in both cases!

something’s (very) wrong!

Page 19: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

Reliable Transfer Mechanisms

26

Checksums Timers Sequence Numbers ACKs, Negative ACKs Window/Pipelining

Note: re-ordered packets – addressed by packets can not live in the network for longer than some fixed max amount of time

Page 20: PowerPoint Presentation · Data and Computer Communications Networks Transport Layer ... 3.1 Transport-layer Services ... – window slides forward over the sequence number space

References

Some of the slides are identical or derived from

1. Slides for the 7th edition of the book Kurose & Ross, “Computer Networking: A Top-Down Approach,”

2. Computer Networking, Nick McKeown and Philip Levis, 2014 Stanford University