96
Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: Assign 1 is due today Credit for lecture slides to Professor Bechir Hamdaoui

Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Embed Size (px)

Citation preview

Page 1: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 1

ECE/CS 372 – introduction to computer networks

Lecture 5

Announcements:

Assign 1 is due today

Credit for lecture slides to Professor Bechir Hamdaoui Adapted from Jim Kurose & Keith Ross (original copyright)

Page 2: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 2

Chapter 3: Transport Layer

Our goals: understand

principles behind transport layer services: reliable data

transfer flow control congestion

control

learn about transport layer protocols in the Internet: UDP: connectionless

transport TCP: connection-

oriented transport TCP congestion

control

Page 3: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 3

Transport services and protocols provide logical

communication between app processes running on different hosts

transport protocols run in end systems send side: breaks app

messages into segments, passes to network layer

rcv side: reassembles segments into messages, passes to app layer

more than one transport protocol available to apps Internet: TCP and UDP

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

logical end-end transport

Page 4: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 4

What transport service does an app need?Data loss/reliability some apps (e.g., audio)

can tolerate some loss other apps (e.g., file

transfer, telnet) require 100% reliable data transfer

Timing some apps (e.g.,

Internet telephony, interactive games) require low delay to be “effective”

Bandwidth some apps (e.g.,

multimedia) require minimum amount of bandwidth to be “effective”

other apps (“elastic apps”) make use of whatever bandwidth they get

Security Privacy, authentication,

integrity

Page 5: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 5

Transport service requirements of common apps

Application

file transfere-mail

Web documentsreal-time audio/video(telephone, video conf.)

stored audio/videointeractive gamesinstant messaging

Data loss

no lossno lossno lossloss-tolerant

loss-tolerantloss-tolerantno loss

Bandwidth

elasticelasticelasticaudio: 5kbps-1Mbpsvideo:10kbps-5Mbpssame as above few kbps upelastic

Time Sensitive

nononoyes, 100’s msec

yes, few secsyes, 100’s msecyes and no

Page 6: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 6

Internet transport-layer protocols TCP: reliable, in-

order delivery congestion control flow control connection setup

UDP: unreliable, unordered delivery extension of “best-

effort” IP

application

transportnetworkdata linkphysical network

data linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

logical end-end transport

Page 7: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 7

What services do Internet transport protocols provide?TCP service: connection-oriented: setup

required between client and server processes

reliable transport between sending and receiving process

flow control: sender won’t overwhelm receiver

congestion control: throttle sender when network overloaded

does not provide: timing, minimum bandwidth guarantees

UDP service: unreliable data transfer

between sending and receiving process

does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee

Q: why bother? Why is there a UDP?

Page 8: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 8

UDP: User Datagram Protocol [RFC 768]

“best effort” service, UDP segments may be: lost delivered out of order

to app connectionless:

no handshaking between UDP sender, receiver

each UDP segment handled independently of others

Why is there a UDP? less delay: no connection

establishment (which can add delay)

simple: no connection state at sender, receiver

less traffic: small segment header

no congestion control: UDP can blast away as fast as desired

Page 9: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 9

Transport vs. network layer network layer: logical communication between hosts transport layer: logical communication between

processes

Household case: 12 kids (East coast

house) sending letters to 12 kids (West coast house)

Ann is responsible for the house at East coast

Bill is responsible for the house at West coast

Postal service is responsible for between houses

Household analogy: kids = processes/apps letters = messages houses = hosts home address = IP

address kid names = port

numbers Ann and Bill = transport

protocol postal service = network-

layer protocol

Page 10: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 10

Chapter 3 outline

Principles of reliable data transfer

Connection-oriented transport: TCP

Principles of congestion control

TCP congestion control

Page 11: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 11

Principles of reliable data transfer important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

Page 12: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 12

Principles of reliable data transfer important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

Page 13: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 13

Principles of reliable data transfer important in app., transport, link layers top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt)

Page 14: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 14

Reliable data transfer: getting started

sendside

receiveside

rdt_send(): called from above, (e.g., by app.). Passed data to deliver to receiver upper layer

udt_send(): called by rdt,to transfer packet over unreliable channel to

receiver

rdt_rcv(): called when packet arrives on rcv-side of channel

deliver_data(): called by rdt to deliver data to

upper

Page 15: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 15

Reliable data transfer: getting startedWe will: incrementally develop sender, receiver

sides of reliable data transfer protocol (rdt) consider only unidirectional data transfer use finite state machines (FSM) to specify

sender, receiver

state1

state2

event causing state transitionactions taken on state transition

state: when in this “state” next state

uniquely determined by next event

eventactions

Page 16: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 16

rdt1.0: reliable transfer over a reliable channel

underlying channel perfectly reliable no bit errors no loss of packets

separate FSMs for sender, receiver: sender sends data into underlying channel receiver read data from underlying channel

Wait for call from above packet = make_pkt(data)

udt_send(packet)

rdt_send(data)extract (packet,data)deliver_data(data)

Wait for call from

below

rdt_rcv(packet)

sender receiver

Page 17: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 17

rdt2.0: channel with bit errors

underlying channel may flip bits in packet Receiver can detect bit errors (e.g., use error detection) But still no packet loss

questions: (1) how does sender know there is an error, and (2) what does it do when there is an error: acknowledgements:

• positive ack (ACK): receiver tells sender that pkt received OK• negative ack (NAK): receiver tells sender that pkt had erros

retransmission: sender retransmits pkt on receipt of NAK

new mechanisms in rdt2.0 (beyond rdt1.0): error detection receiver feedback: control msgs (ACK,NAK) rcvr->sender assume ACK/NAK are error free

Page 18: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 19

rdt2.0: operation with no errors

Wait for call from above

snkpkt = make_pkt(data, checksum)udt_send(sndpkt)

extract(rcvpkt,data)deliver_data(data)udt_send(ACK)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isNAK(rcvpkt)

udt_send(NAK)

rdt_rcv(rcvpkt) && corrupt(rcvpkt)

Wait for ACK or NAK

Wait for call from below

rdt_send(data)

sender

receiver

Page 19: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 20

rdt2.0: error scenario

Wait for call from above

snkpkt = make_pkt(data, checksum)udt_send(sndpkt)

extract(rcvpkt,data)deliver_data(data)udt_send(ACK)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

udt_send(sndpkt)

rdt_rcv(rcvpkt) && isNAK(rcvpkt)

udt_send(NAK)

rdt_rcv(rcvpkt) && corrupt(rcvpkt)

Wait for ACK or NAK

Wait for call from below

rdt_send(data)

sender

receiver

Page 20: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 21

rdt2.0 has a fatal flaw!

What happens if ACK/NAK is corrupted? That is, sender receives garbled ACK/NAK

sender doesn’t know what happened at receiver!

can’t sender just retransmit? Sure: sender retransmits current

pkt if ACK/NAK garbled Any problem with this ??

Handling duplicates: sender adds sequence

number to each pkt receiver discards

(doesn’t deliver up) duplicate pkt

Sender sends one packet, then waits for receiver response

stop and waitstop and waitSender sends one packet, then waits for receiver response

stop and wait

Receiver doesn’t know whether received pkt is a retransmit or a new pkt

Problem: duplicate

Page 21: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 22

rdt2.1: sender, handles garbled ACK/NAKs

Wait for call 0 from above

sndpkt = make_pkt(0, data, checksum)udt_send(sndpkt)

rdt_send(data)

Wait for ACK or NAK

0 udt_send(sndpkt)

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isNAK(rcvpkt) )

sndpkt = make_pkt(1, data, checksum)udt_send(sndpkt)

rdt_send(data)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt)

udt_send(sndpkt)

rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) ||isNAK(rcvpkt) )

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt)

Wait for call 1 from

above

Wait for ACK or NAK 1

Page 22: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 23

rdt2.1: receiver, handles garbled ACK/NAKs

Wait for 0 from below

sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq0(rcvpkt)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt)

extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

Wait for 1 from below

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt)

extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq1(rcvpkt)

rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

sndpkt = make_pkt(ACK, chksum)udt_send(sndpkt)

sndpkt = make_pkt(NAK, chksum)udt_send(sndpkt)

Page 23: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 24

rdt2.1: discussion

Sender: seq # added to pkt two seq. #’s (0,1)

will suffice. Why? must check if

received ACK/NAK corrupted

twice as many states state must

“remember” whether “current” pkt has 0 or 1 seq. #

Receiver: must check if

received packet is duplicate state indicates

whether 0 or 1 is expected pkt seq #

note: receiver can not know if its last ACK/NAK received OK at sender

Page 24: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 25

rdt2.2: a NAK-free protocol

do we really need NAKs??

instead of NAK, receiver sends ACK for last pkt received OK receiver must explicitly include seq # of pkt being ACKed

duplicate ACK at sender results in same action as NAK: retransmit current pkt

rdt2.2: same functionality as rdt2.1, using ACKs only

Page 25: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 26

rdt3.0: channels with errors and loss

New assumption: packet may be lost: underlying channel can also lose packets (data or ACKs)

checksum, seq. #, ACKs, retransmissions will be of help, but not enough

What else is needed?

Approach: timeout policy:

sender waits “reasonable” amount of time for ACK

retransmits if no ACK received in this time

if pkt (or ACK) just delayed (not lost): retransmission will be

duplicate, but use of seq. #’s already handles this

receiver must specify seq # of pkt being ACKed

requires countdown timer

Page 26: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 27

rdt3.0 in action (still stop-n-wait w/ (0,1) sn)

Page 27: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 28

rdt3.0 in action (still stop-n-wait w/ (0,1) sn)

Page 28: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 29

Performance of rdt3.0: stop-n-wait

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance stinks example: R=1 Gbps, RTT=30 ms, L=1000Byte packet:

Ttransmit

= 8.103 b/pkt109 b/sec

= 8 microsecL (packet length in bits)R (transmission rate, bps)

=

Page 29: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 30

Performance of rdt3.0: stop-n-wait

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance stinks example: R=1 Gbps, RTT=30 ms, L=1000Byte packet:

U sender: utilization – fraction of time sender busy sending

U sender

= .008

30.008 = 0.00027

microseconds

L / R

RTT + L / R =

Page 30: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 31

Performance of rdt3.0: stop-n-wait

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance stinks example: R=1 Gbps, RTT=30 ms, L=1000Byte packet:

1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link network protocol limits use of physical resources!

Page 31: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 32

Pipelining: increased utilization

first packet bit transmitted, t = 0

sender receiver

RTT

last bit transmitted, t = L / R

first packet bit arriveslast 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

U sender

= .024

30.008 = 0.0008

microseconds

3 * L / R

RTT + L / R =

Increase utilizationby a factor of 3!

Question: What is the link utilization Usender

Page 32: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 33

Pipelined protocolsPipelining: sender allows multiple, “in-flight”, yet-to-be-ACK’ed

pkts What about the range of sequence numbers then?? What about buffering at receiver??

Page 33: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 34

ECE/CS 372 – introduction to computer networks

Lecture 6

Announcements:

Assignment 1 Solutions Posted

Credit for lecture slides to Professor Bechir Hamdaoui Adapted from Jim Kurose & Keith Ross (original copyright)

Page 34: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 35

So far: rdt3.0

Acknowledgment and retransmission Reliable delivery

Sequence numbers Duplication detection

Timeout and retransmit Deal with packet losses

Stop-n-wait one packet at a time

Problem: efficiency

Page 35: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 36

Performance of rdt3.0: stop-n-wait

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance is terribad example: R=1 Gbps, RTT=30 ms, L=1000Byte packet:

U sender: utilization – fraction of time sender busy sending

U sender

= .008

30.008 = 0.00027

microseconds

L / R

RTT + L / R =

Page 36: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 37

Performance of rdt3.0: stop-n-wait

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

rdt3.0 works, but performance stinks example: R=1 Gbps, RTT=30 ms, L=1000Byte packet:

1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link network protocol limits use of physical resources!

Page 37: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 38

Pipelined protocolsPipelining: sender allows multiple, “in-flight”, yet-to-be-ACK’ed

pkts What about the range of sequence numbers then?? What about buffering at receiver??

Two generic forms of pipelined protocols: go-Back-N and selective repeat

Page 38: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 39

Go-Back-NSender side ‘N’ (or W) packets can

be sent w/o being ACK’ed

Fills “sliding window” Single timer: oldest

non-ACK’ed packet At timeout(n),

retransmit packet n and all successive packets in window

Receiver side Cumulative ACK Discard out-of-order

packets, no buffering

Page 39: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Selective Repeat

Chapter 3, slide: 40

Sender side ‘N’ (or W) packets can be sent w/o being ACK’ed, Fills “sliding window” ‘N’ (or W) timers: every packet in window At timeout(n), retransmit packet n ACK for bottom of window? Advance window to the next

un-ACK’ed packet

Receiver side Selective ACK ACK and Buffer out-of-order segments (if in window) Discard out-of-order packets (if ahead of window) ACK and Discard out-of-order packets (if behind window) In-order packet? ACK and deliver, then deliver all

sequential buffered packets and advance window!

Page 40: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 41

Selective repeat in action

GBN? GBN?

GBN?

Page 41: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 42

GBN/SR comparison

Selective Repeat Sliding window

W packets in the pipe Selective ACK One timer for each

packet Buffer out-of-order

packets (within window) Retransmit only lost or

delayed packet at timeout

Go-Back-N Sliding window

W packets in the pipe Cumulative ACK Single timer (oldest

un-ACK’ed packet) Discard out-of-order

packets Retransmit all

successive packets at timeout

Page 42: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 43

Selective repeat:dilemmaExample: Seq #’s: 0, 1, 2, 3 Window Size = 3

Receiver sees no difference in two scenarios! Even though, (a) is a retransmitted

packet (b) is a new packet

in (a), receiver incorrectly passes old data as newQ: What relationship between

sequence # size and window size to avoid duplication problem??

Page 43: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Let’s assume window size W = 2 for illustration

Consider a scenario where:Only ACK 1 is lost

Next, assume the Sequence Number (SN) space n = W = 2That is, SN pattern is 0,1,0,1,0,1,…

Chapter 3, slide: 44

Page 44: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Scenario: n=W=2; only ACK 1 is lost

Chapter 3, slide: 45

Receiver thinks of retransmission of 2nd Packet (Pkt1, SN=1) as a 4th/new Pkt (Pkt3,SN=1) Duplication detection problem!

Page 45: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Recap:

When window size (W) = Sequence Number space (n), there is a duplication problem receiver can’t tell a new transmission from a retransmission of a lost packet

Let’s now see what happens if we increase n by 1: Now n=3 and SN pattern is: 0,1,2,0,1,2,0…

Let’s revisit the scenario again

Chapter 3, slide: 46

Page 46: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Scenario: n=3;W=2; ACK 1 is lost

Chapter 3, slide: 47

Receiver still thinks of retransmission of 2nd Packet (Pkt1,SN=1) as a new Pkt (Pkt3,SN=1) Increasing n by 1 didn’t solve the duplication detection problem this time!!

Page 47: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Recap:

Increasing SN space n from 2 to 3 didn’t solve the duplication problem yet!

Let’s now see what happens if we again increase n by 1: Now n=4 and SN pattern is: 0,1,2,3,0,1,2,3,0…

Let’s revisit the scenario with n=4 and see

Chapter 3, slide: 48

Page 48: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Scenario: n=4;W=2; ACK 1 is lost

Chapter 3, slide: 49

Receiver now drops this retransmission of 2nd Packet (Pkt1, SN=1) since its SN falls outside the window Duplication detection problem is now solved when n=2W=4

Page 49: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Duplication problem: illustration

Recap: Increasing SN space n from 2 to 4 did solve the

duplication problem

That is, when SN space = twice window size (n = 2W) the duplication problem was solved

Hence, in this case: when W ≤ n/2, the problem is solved

Can we generalize? Yes, W ≤ n/2 must hold in order to avoid duplication problem

Chapter 3, slide: 50

Page 50: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Sequence Number space n & window size W relationship: general case

Sender: Suppose ½ n < W < n

W segments with SN in [0, W-1] are sent, but their ACKs are not received yet

0 1n-1

W-1

wpkts already sent,

but ACKs not received yet

= sender’s sliding window

seqNbr space

Page 51: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Receiver: Now assume: receiver received all W

segments (SN in [0,W-1])

receiver sent all W ACKs, one for each received segment

receiver slides its window: Sliding window (SN of expected segments) from:

W to x = 2W-n-1

Hint: (n-1-W+1) + (x-0+1)=W x=2W–n-1

0n-1

W

seqNbr expected by receiver

Chapter 3, slide: 52

x=2W-n-1

Sequence Number space n & window size W relationship: general case

1

Page 52: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Consider worst case scenario: all W ACKs are lost

Sender will re-transmit all the first W segments; i.e., with SN in [0,W-1]

But receiver is expecting segments with SN in [W,n-1] U [0,2W-n-1]

Retransmissions with SN falling within [0,2W-n-1] will then be interpreted by receiver as new transmissions ( dup problem)

To avoid dup problem, we must then

have: 2W-n-1 ≤ -1 W ≤ ½ n

0n-1

W

SN expected by receiver

x=2W-n-1

SN

retransmitted

by sender

SN overlap

Sequence Number space n & window size W relationship: general case

Page 53: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 54

ECE/CS 372 – introduction to computer networks

Lecture 7

Announcements:

Assignment 2 and Lab 2 are posted

Credit for lecture slides to Professor Bechir Hamdaoui Adapted from Jim Kurose & Keith Ross (original copyright)

Page 54: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 55

Chapter 3 outline

Principles of reliable data transfer

Connection-oriented transport: TCP

Principles of congestion control

TCP congestion control

Page 55: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 56

TCP Round Trip Time (RTT) and TimeoutWhy need to estimate RTT? “timeout” and “retransmit”

needed to address packet loss

need to know when to timeout and retransmit

Ideal world: exact RTT is needed

Real world: RTTs change over time:

packets may take different paths

network load changes over time RTTs can only be estimated

Some intuition What happens if too

short? Premature timeout Unnecessary

retransmissions

What happens if too long? Slow reaction to

segment loss

Page 56: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 57

Technique: Exponential Weighted Moving Average (EWMA)

EstimatedRTT(current) = (1-)*EstimatedRTT(previous) + *SampleRTT(recent)

0 < < 1; typical value: = 0.125

SampleRTT: measured time from segment transmission until ACK

receipt current value of RTT Ignore retransmission

EstimatedRTT: estimated based on past & present; smoother than

SampleRTT to be used to set timeout period

TCP Round Trip Time (RTT) and Timeout

Page 57: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 58

Technique: Exponential Weighted Moving Average (EWMA)

EstimatedRTT(current) = (1-)*EstimatedRTT(previous) + *SampleRTT(recent)

0 < < 1; typical value: = 0.125

TCP Round Trip Time (RTT) and Timeout

Illustration: Assume: we received n RTT samples so far: Let’s order them as: n is the most recent one, n-1 is the 2nd most recent, etc.

EstimatedRTT(n) = (1-)*EstimatedRTT(n-1) + *SampleRTT(n)

(EstimatedRTT(n) : estimated RTT after receiving ACK of nth Packet.)

Example: Supppse 3 ACKs returned with SampleRTT(1), SampleRTT(2), SampleRTT(3)

Question: What would be EstimatedRTT after receiving the 3 ACKs ? Assume: EstimatedRTT(0) = 2 seconds (initial/default value)

Page 58: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 59

Technique: Exponential Weighted Moving Average (EWMA)

EstimatedRTT(current) = (1-)*EstimatedRTT(previous) + *SampleRTT(recent)

0 < < 1; typical value: = 0.125

What happens if is too small (say very close 0): A sudden, real change in network load does not get reflected in

EstimatedRTT fast enough May lead to under- or overestimation of RTT for a long time

What happens if is too large(say very close 1): Transient fluctuations/changes in network load affects

EstimatedRTT and makes it unstable when it should not Also leads to under- or overestimation of RTT

TCP Round Trip Time (RTT) and Timeout

Page 59: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 60

Example RTT estimation:RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

100

150

200

250

300

350

1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106

time (seconnds)

RTT

(mill

isec

onds

)

SampleRTT Estimated RTT

Page 60: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 61

Setting the timeout timeout = EstimtedRTT, any problem with this???

add a “safety margin” to EstimtedRTT large variation in EstimatedRTT -> larger safety margin

see how much SampleRTT deviates from EstimatedRTT:

TimeoutInterval = EstimatedRTT + 4*DevRTT

DevRTT = (1-)*DevRTT + *|SampleRTT-EstimatedRTT|(typically, = 0.25)

Then set timeout interval:

TCP Round Trip Time (RTT) and Timeout

Page 61: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 62

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

full duplex data: bi-directional data flow

in same connection MSS: maximum

segment size

connection-oriented: handshaking (exchange

of control msgs) init’s sender, receiver state before data exchange

flow controlled: sender will not

overwhelm receiver

point-to-point: one sender, one

receiver

reliable, in-order byte stream: no “message

boundaries”

pipelined: TCP congestion and flow

control set window size

send & receive bufferssocketdoor

T C Psend buffer

T C Preceive buffer

socketdoor

segm ent

applicationwrites data

applicationreads data

Page 62: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 63

TCP: a reliable data transfer

TCP creates rdt service on top of IP’s unreliable service

Pipelined segments Cumulative acks TCP uses single

retransmission timer

Retransmissions are triggered by: timeout events duplicate acks

Initially consider simplified TCP sender: ignore duplicate acks ignore flow control,

congestion control

Page 63: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 64

TCP sender events:Data received from app: Create segment with

Seq # Seq # is byte-stream

number of first data byte in segment

start timer if not already running (think of timer as for “oldest unACK’ed segment”)

expiration interval: TimeOutInterval

Timeout: retransmit segment

that caused timeout restart timer Ack received: If it acknowledges

previously unACK’ed segments update what is known

to be ACK’ed start timer if there are

outstanding segments

Page 64: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 65

TCP Seq. #’s and ACKsSeq. #’s:

byte stream “number” of first byte in segment’s data

ACKs: Seq # of next

byte expected from other side

cumulative ACK

Host A Host B

Seq=42, ACK=79, data = ‘C’

Usertypes

‘C’

Seq=43, ACK=80

host ACKsreceipt

of echoed‘C’

Seq=79, ACK=43, data = ‘C’

host ACKsreceipt of

‘C’, echoesback ‘C’

timesimple telnet scenario

Page 65: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 66

TCP: retransmission scenarios

Host A

Seq=92, 8 bytes data

ACK=100

loss

tim

eout

lost ACK scenario

Host B

X

Seq=92, 8 bytes data

ACK=100

time

Host A

Seq=100, 20 bytes data

ACK=100

timepremature timeout

Host B

Seq=92, 8 bytes data

ACK=120

Seq=92, 8 bytes data

Seq=

92

tim

eout

ACK=120

Seq=

92

tim

eout

Page 66: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 67

TCP retransmission scenarios (more)

Host A

Seq=92, 8 bytes data

ACK=100

loss

tim

eout

Cumulative ACK scenario

Host B

X

Seq=100, 20 bytes data

ACK=120

time

Page 67: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 68

TCP ACK generation [RFC 1122, RFC 2581]

Event at Receiver

Arrival of in-order segment withexpected seq #. All data up toexpected seq # already ACKed

Arrival of in-order segment withexpected seq #. One other segment has ACK pending

Arrival of out-of-order segmenthigher-than-expect seq. # .Gap detected

Arrival of segment that partially or completely fills gap

TCP Receiver action

Delayed ACK. Wait up to 500msfor next segment. If no next segment,send ACK

Immediately send single cumulative ACK, ACKing both in-order segments

Immediately send duplicate ACK, indicating seq. # of next expected byte

Immediate send ACK, provided thatsegment starts at lower end of gap

Page 68: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 69

Fast Retransmit Suppose: Packet 0 gets lost

Q: When will retransmission of Packet 0 happen? Why does it happen at that time?

A: typically at t1 ; we think it is lost when timer expires

Can we do better?? Think of what means to receive

many duplicate ACKs: it means Packet 0 is lost Why wait until timeout when we

know packet 0 is lost? => Fast retransmit

=> better performance Why several dupl. ACKs, not 1 or 2?

Think of what happens when pkt0 arrives after pkt1 (delayed, not lost)

Think of what happens when pkt0 arrives after pkt1 & 2, etc.

client server

Packet 0Timer isset at t0

Timer expires

at t1

Packet 1Packet 2Packet 3

ACK0

ACK0

ACK0

Packet 0

Packet 0

Page 69: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 70

Fast Retransmit: recap Receipt of duplicate

ACKs indicate loss of segments Sender often sends

many segments back-to-back

If segment is lost, there will likely be many duplicate ACKs.

This is how TCP works: If sender receives 3 ACKs

for the same data, it supposes that segment after ACK’ed data was lost:

Fast Retransmit: resend segment before

timer expires better performance

Page 70: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 71

Review questions

Problem: TCP connection between A and B B received up to 248 bytes A sends back-to-back 2 segments

to B with 40 and 60 bytes B ACKs every packet it receives

Q1: What is Seq# in 1st and 2nd segments from A to B?

Q2: Suppose: 1st segment gets to B first. What is ACK # in 1st ACK?

Host A Host BSeq=249, 40 bytes

Seq=289, 60 bytes

ACK=289

Page 71: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 72

Review questions

Problem: TCP connection between A and B B received up to 248 bytes A sends back-to-back 2 segments

to B with 40 and 60 bytes B ACKs every packet it receives

Q1: What is Seq# in 1st and 2nd segments from A to B?

Q2: Suppose: 1st segment gets to B first. What is ACK # in 1st ACK?

Q3: Suppose: 2nd segment gets to B first. What is ACK # in 1st ACK? What is ACK # in 2nd ACK?

Host A Host BSeq=249, 40 bytes

Seq=289, 60 bytes

ACK=??

ACK=??

Page 72: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 73

Review questions

Problem: TCP connection between A and B B received up to 248 bytes A sends back-to-back 2 segments to

B with 40 and 60 bytes B ACKs every packet it receives

Q1: What is Seq# in 1st and 2nd segments from A to B?

Q2: Suppose: 1st segment gets to B first.What is ACK # in 1st ACK?

Q3: Suppose: 2nd segment gets to B first.What is ACK # in 1st ACK? What is ACK # in 2nd ACK?

Host A Host BSeq=249, 40 bytes

Seq=289, 60 bytes

ACK=249

ACK=349

Page 73: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 74

Review questions

Problem: TCP connection between A and B B received up to 248 bytes A sends back-to-back 2 segments

to B with 12 and 20 bytes, respectively

B ACKs every packet it receives

Now suppose: - 2 segments get to B in order. - 1st ACK is lost- 2nd ACK arrives after timeout

Question: Fill out all packet Seq #’s, and ACKs’ ACK #’s in the timing diagram.

Page 74: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 75

ECE/CS 372 – introduction to computer networks

Lecture 8

Announcements:

Assignment 2 due next Tuesday Lab 2 due next Tuesday

Midterm exam: next Thursday

Credit for lecture slides to Professor Bechir Hamdaoui Adapted from Jim Kurose & Keith Ross (original copyright)

Page 75: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 76

Chapter 3 outline

Principles of reliable data transfer

Connection-oriented transport: TCP

Principles of congestion control

TCP congestion control

Page 76: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 77

Principles of Congestion Control Oct. ’86: LBL (Lawrence Berkeley Lab) to UC-Berkeley:

drop from 32kbps to 40bps (400 yards, two IMP hops)

Congestion Collapse! Cause:

end systems are sending too much data too fast for network/routers to handle

Manifestations: lost/dropped packets (buffer overflow at routers) long delays (queueing in router buffers)

a top-10 problem!

Page 77: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 78

Approaches towards congestion control

End-end congestion control:

no explicit feedback from network

congestion inferred from end-system observed loss, delay

approach taken by TCP

One restriction on sliding window: CongWin

Network-assisted congestion control:

routers provide feedback to end systems single bit indicating

congestion (DECbit, TCP/IP ECN)

explicit rate sender should send at

Two broad approaches toward congestion control:

Page 78: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 79

TCP congestion control Keep in mind:

Too slow: under-utilization => waste of network resources by not using them!

Too fast: over-utilization => waste of network resources by congesting them!

Challenge is then: Not too slow, nor too fast!!

Approach: Increase slowly the sending rates to probe for usable

bandwidth Decrease the sending rates when congestion is observed=> Additive-increase, multiplicative decrease (AIMD)

Page 79: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 80

Additive-increase, multiplicative decrease (AIMD)(also called “congestion avoidance”)

additive increase: increase CongWin by 1 MSS every RTT until loss detected (MSS = Max Segment Size)

multiplicative decrease: cut CongWin in half after loss

8 Kbytes

16 Kbytes

24 Kbytes

time

congestionwindow

time

cong

estio

n w

indo

w s

ize

Saw toothbehavior: probing

for bandwidth

TCP congestion control: AIMD

Page 80: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 81

TCP Congestion Control: details

sender limits transmission: LastByteSent-LastByteAcked

CongWin Roughly,

CongWin is dynamic, function of perceived network congestion

How does sender perceive congestion?

loss event timeout or 3 duplicate ACKs

TCP sender reduces rate (CongWin) after loss event

AIMD increases window by 1 MSS every RTT

Improvements: AIMD, any problem??

Think of the start of connections

Solution: start a little faster, and then slow down=>“slow-start”

rate = CongWin

RTT Bytes/sec

Page 81: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 82

TCP Slow Start

When connection begins, CongWin = 1 MSS Example: MSS = 500

Bytes RTT = 200 msec initial rate = 20 kbps

available bandwidth may be >> MSS/RTT desirable to quickly

ramp up to respectable rate

TCP addresses this via Slow-Start mechanism

When connection begins, increase rate exponentially fast

When loss of packet occurs (indicates congestion), then slow down

Page 82: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 83

TCP Slow Start (more)

How it is done When connection

begins, increase rate exponentially until first loss event: double CongWin every

RTT done by incrementing CongWin for every ACK received

Summary: initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

Page 83: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 84

Refinement: TCP TahoeQuestion: When should exponential increase (Slow-Start) switch to linear (AIMD)?

Here is how it works: Define a variable, called Threshold Start “Slow-Start” (i.e., CongWin =1 and double CongWin every RTT) At 1st loss event (timeout or 3 Dup ACKs),

Set Threshold = ½ current CongWin

Start “Slow-Start” (i.e., CongWin = 1 and double CongWin every RTT) When CongWin =Threshold:

Switch to AIMD (linear) At any loss event (timeout or 3 Dup ACKs):

Set Threshold = 1/2 CongWin Start “Slow-Start” (i.e. start over with CongWin = 1)

Page 84: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 85

Refinement: TCP TahoeQuestion: When should exponential increase (Slow-Start) switch to linear (AIMD)?

CongWin

Page 85: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 86

More refinement: TCP RenoLoss event: Timeout vs. dup ACKs

3 dup ACKs: fast retransmit

client server

Packet 0Timer isset at t0

Timer expires

at t1

Packet 1Packet 2Packet 3

ACK0

ACK0

ACK0

Packet 0

Page 86: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 87

More refinement: TCP RenoLoss event: Timeout vs. dup ACKs

3 dup ACKs: fast retransmit

Timeout: retransmit

client server

Packet 0Timer isset at t0

Timer expires

at t1

Packet 1Packet 2Packet 3

Packet 0

Any difference (think congestion) ??

3 dup ACKs indicate network still capable of delivering some segments after a loss

Timeout indicates a “more” alarming congestion scenario

Page 87: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 88

More refinement: TCP RenoTCP Reno treats “3 dup ACKs” different from “timeout”

How does TCP Reno work?

After 3 dup ACKs: CongWin is cut in half congestion avoidance

(window grows linearly)

But after timeout event: CongWin instead set

to 1 MSS; Slow-Start (window

grows exponentially)

Page 88: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 89

Summary: TCP Congestion Control

When CongWin is below Threshold, sender in slow-start phase, window grows exponentially.

When CongWin is above Threshold, sender is in congestion-avoidance phase, window grows linearly.

When a triple duplicate ACK occurs, Threshold set to CongWin/2 and CongWin set to Threshold.

When timeout occurs, Threshold set to CongWin/2 and CongWin is set to 1 MSS.

Page 89: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 90

TCP Flow Control

receive side of TCP connection has a receive buffer:

speed-matching service: matching the send rate to the receiving app’s drain rate

One more restriction on sliding window: RcvWindow

app process may be slow at reading from buffer

sender won’t overflow

receiver’s buffer bytransmitting too

much, too fast

flow control

Page 90: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 91

TCP Flow control: how it works

spare room in buffer= RcvWindow

= RcvBuffer-[LastByteRcvd - LastByteRead]

Rcvr advertises spare room by including value of RcvWindow in segments

Sender limits unACKed data to RcvWindow guarantees receive

buffer doesn’t overflow

Page 91: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 92

Average throughput of TCPAvg. throughout as a function of window size W and RTT?

Ignore Slow-Start Let W, the window size when loss occurs, be constant

When window is W, throughput is ?? throughput(high) = W/RTT Just after loss, window drops to W/2, throughput is ??

throughput(low) = W/(2RTT). Throughput then increases linearly from W/(2RTT) to

W/RTT Hence, average throughout = 0.75 W/RTT

Page 92: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 93

Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K

TCP connection 1

bottleneckrouter

capacity R

TCP connection 2

TCP Fairness

Page 93: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 94

Fairness (more)Fairness and parallel TCP connections nothing prevents app from opening parallel

conections between 2 hosts. Web browsers do this

Example: link of rate R supporting 9 connections; 9 TCPs belong to same host, each getting R/9 new app asks for 1 TCP, gets rate R/10 One host gets 9/10 of R and one gets 1/10 of R!

Page 94: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 95

Question: is TCP fair?Again assume two competing sessions only, and consider AIMD: Additive increase gives slope of 1, as throughout increases Multiplicative decrease halves throughput proportionally, when

congestion occurs

TCP connection 1

bottleneckrouter

capacity R

TCP connection 2

Page 95: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 96

Question: is TCP fair?Again assume two competing sessions only, and consider

AIMD: Additive increase gives slope of 1, as throughout increases Multiplicative decrease halves throughput proportionally,

when congestion occurs Question: How would (R1, R2)

varywhen AIMD is used?

Does it converge to equal share?

R

R

equal bandwidth share

Connection 1 throughputConnect

ion 2

th

roughput

congestion avoidance: additive increaseloss: decrease window by factor of 2

congestion avoidance: additive increaseloss: decrease window by factor of 2

Page 96: Chapter 3, slide: 1 ECE/CS 372 – introduction to computer networks Lecture 5 Announcements: r Assign 1 is due today Credit for lecture slides to Professor

Chapter 3, slide: 97

Question?Again assume two competing sessions only: Additive increase gives slope of 1, as throughout increases Constant/equal decrease instead of multiplicative

decrease!!! (Call this scheme: AIED)

R

R

equal bandwidth share

Connection 1 throughputConnect

ion 2

th

roughput

(R1, R2)

Question: How would (R1, R2)

vary when AIED is used instead of AIMD?

Is it fair? Does it converge to equal share?