50
Week 4 Reliable transport Sharing resources

4 transport-sharing

Embed Size (px)

DESCRIPTION

Fourth lesson of the Computer Networking class. Covers reliable transport principles and the introduction for sharing resources (MAC and congestion control)

Citation preview

Page 1: 4 transport-sharing

Week 4Reliable transportSharing resources

Page 2: 4 transport-sharing

Agenda

•Reliable transport

•Multiplexing

•Connection establishment

•Data transfer

•Connection release

•Sharing resources

Page 3: 4 transport-sharing

Multiplexing applications

•How can we multiplex data from several applications running on the same host ?

Page 4: 4 transport-sharing

Multiplexing

ServerClientSource port : 1234

Destination port: 5678

Request

Response

Source port : 5678Destination port: 1234

Page 5: 4 transport-sharing

Agenda

•Reliable transport

•Multiplexing

•Connection establishment

•Data transfer

•Connection release

•Sharing resources

Page 6: 4 transport-sharing

Connection establishment

•How to reliably open a connection ?

Connect.reqConnect.ind

CR

CAConnection established

Connect.respConnect.conf

Connection established

Page 7: 4 transport-sharing

Segment loss

Connect.req()

Connect.ind()

Connect.conf() CA Connection established

Connection established

CR

CR Retransmission timer expires

Connect.resp()

Page 8: 4 transport-sharing

Segments delayed

Connect.ind()

CR

Connect.conf() CA

CR

Old previous CR

First connection established

How to detect duplicates ?

Connect.req()

D

CA

Connect.respFirst connection established

First connection stopped First connection stopped

Page 9: 4 transport-sharing

Delayed segments

•How to deal with delayed segments ?

•Network level guarantee

•No packet will survive more than MSL seconds inside the network

•Transport entities use on a local clock to detect duplicated connection establishment requests

Page 10: 4 transport-sharing

Three way handshake

CR (seq=x)

CA (seq=y, ack=x)

CA (seq=x, ack=y)

Sequence number x readfrom local transport clock

Local state :Connection to B : - Wait for ack for CR (x)- Start retransmission timer

Sequence number y read fromlocal transport clockCA sent to ack CR

Local state :Connection to A :

- Wait for ack for CA(y)

Received CA acknowledges CRSend CA to ack received CA

Local state :Connection to B :

- established- current_seq = x

The sequence numbers used for the data segments will startfrom x

The sequence numbersused for the data segmentswill start from y

D(x)

D(y)

Local state :Connection to A :

- established- current_seq=yConnection established

Connection established

Host A Host B

Page 11: 4 transport-sharing

Three way handshake (2)

CA (seq=y, ack=z)

CR (seq=z)

REJECT (ack=y)

Connection cancelled

No connection is established

Host A Host BSequence number y read from

local transport clockAcknowledges CR segment

Local state :Connection to A :

- Wait for ack for CA(y)

Local state :No connection to B

Send REJECT to cancelconnection establishment

Page 12: 4 transport-sharing

Three way handshake (3)

CR (seq=z)

Current state does not contain a CR with seq=x

REJECT (ack=y)

Connection established

CR (seq=z)Retransmission timerexpires

CA (seq=w, ack=z)

CA (seq=z, ack=w)

CA (seq=y, ack=x)

Sequence number z readfrom local transport clock

Local state :Connection to B :

- Wait for ack for CR (z)- Start retransmission timer

Host A Host B

Current state does not contain a segment with seq=y

REJECT ignored

Sequence number w read fromlocal transport clockCA sent to ack CR

Local state :Connection to A :

- Wait for ack for CA(w)

Received CA acknowledges CRSend CA to ack received CA

Local state :Connection to B :

- established- current_seq = z

Page 13: 4 transport-sharing

Three way handshake (4)

Invalid CA received from ASend REJECT

CA (seq=w, ack=z)

CR (seq=z)

CA (seq=z, ack=y)

REJECT (ack=w)

REJECT (ack=z)

Sequence number w read fromlocal transport clock

Acknowledges CR segmentLocal state :

Connection to A : - Wait for ack for CA(w)

Current state does not contain a CR with seq=z

Host A Host B

No connection is established

Page 14: 4 transport-sharing

Agenda

•Reliable transport

•Multiplexing

•Connection establishment

•Data transfer

•Connection release

•Sharing resources

Page 15: 4 transport-sharing

Reliable data transfer

•What are the differences with the reliable protocols of the datalink layer ?

•Segments can be reordered

•Buffers can change dynamically

•Bytestream service

Page 16: 4 transport-sharing

Retransmission policies

•Which retransmission policy in reliable transport protocols ?

•Alternating Bit

•Go-back-n

•Selective repeat

Page 17: 4 transport-sharing

Buffer management

•A transport entity serves a variable number of applications with a limited buffer

•The buffer/window allocated to a given connection may need to change dynamically as connections start and stop

Page 18: 4 transport-sharing

Buffer management A B

Data.req(a)

Data.ind(a)

D(0,a)

C(OK,0, w=1)

C(OK,0,w=3)

Data.req(c)D(2,c)

2 new buffers becomeavailable

Data.req(b)

Data.ind(b)

D(1,b)

0 1 2 3

0 1 2 3

0 1 2 3

C(OK,1,w=3)

Rwin=1

0 1 2 3

Swin=3, rwin=1

0 1 2 3

Swin=3, rwin=1

0 1 2 3

Swin=3, rwin=1

0 1 2 3

Swin=3, rwin=1

Swin=3, rwin=3

0 1 2 3 Data.req(d)

D(3,d) 0 1 2 3

Page 19: 4 transport-sharing

Buffer management A B

Data.req(b)

Data.ind(a)

Data.req(a)

D(0,a)

C(OK,0, w=0)

2 new buffers areavailable

0 1 2 3

Rwin=1

0 1 2 3

Swin=3, rwin=1

0 1 2 3

Swin=3, rwin=1

0 1 2 3

Receiver cannot handle segment immediately

C(OK,0,w=3)

Lost segment0 1 2 3

Swin=3, rwin=0

Window blockedNo transmission possible

Waits for control segment Waits for data segment

How to recover from deadlock ?Persitence timer on receiver, resend control segment after

timer expiration

Page 20: 4 transport-sharing

Delayed segments

A BD(1,b)

Timer expirationRetransmission D(1,b)

D(3,d)

C(OK,0)

C(OK,0)

C(OK,3)

C(OK,0)

C(OK,1)

D(0,e) Data.ind(e)

Data.ind(b) !!!!!!!!!!!!

D(0,a)

Data.req(a)

Data.ind(a)

Data.ind(b)

Data.ind(e)

Page 21: 4 transport-sharing

Delayed segments

•How to deal with them ?

•Packets cannot live more than MSL seconds inside the network

•Only one segment carrying sequence number x can be transmitted during MSL seconds

•upper bound on maximum throughput

Page 22: 4 transport-sharing

Bidirectional transfer

•How to efficiently carry data in both directions ?

Page 23: 4 transport-sharing

PiggybackingA B

Data.req(a)

Data.ind(a)

D(0,0,a)Data.req(b)

D(1,0,b)

Error

Discarded

Data.req(c)

D(2,0,c)

Segment -> bufferRetransmission

Data.ind(b)

D(1,5,b)

Data.ind(c)

Data.req(d)

D(3,6,d)

Data.ind(d)C(OK,2)

C(OK,3)

Data.req(x)D(5,0,w)

Data.req(w)

Data.ind(w)

D(6,0,x)

Data.ind(x)

D(5,0,w) acks D(0,0,a)

Page 24: 4 transport-sharing

Bytestream

•How to provide a bytestream service ?

Page 25: 4 transport-sharing

Byte stream service (2)

A B

Data.req(ijkl)

Data.req(mnop)

Data.req(abcdef)

Data.ind(ab)

D(0,ab)

C(OK,1)

C(OK,1)

D(2,cd)

Lost segment

D(4,ef)

Placed in buffer

Data.ind(cdef)

D(2,cd)

Expiration timerRetransmission

D(6,ijklmnop)

Data.ind(ijklmnop)C(OK,5)

C(OK,13)

Page 26: 4 transport-sharing

Agenda

•Reliable transport

•Multiplexing

•Connection establishment

•Data transfer

•Connection release

•Sharing resources

Page 27: 4 transport-sharing

Connection release

•Graceful release

•Data transfer is finished and connection must be terminated

•Abrupt release

•Something went wrong and the connection must be closed immediately

•Data can be lost !

Page 28: 4 transport-sharing

Graceful releaseD(‘a’,1233)

DISCONNECT.req (A-B)

DISCONNECT.ind(A-B)

ACK,1234DISCONNECT.conf(A-B)

ACK,4567DISCONNECT.conf(A-B)

DISCONNECT.req(B-A)

DISCONNECT.ind(B-A)

DR(B-A,4567)Outgoing connection (A->B)

closed

Incoming connection (A->B)closed

Incoming connection (B->A)closed

Outgoing connection (B->A)closed

DR(A-B,1234)

DATA.ind(‘a’)

Page 29: 4 transport-sharing

Abrupt release

CR (seq=z)

CA (seq=w, ack=z)

CA (seq=z, ack=w)

D Data.req()

Data.ind()Disc.req()

D Data.req()

DR Disc.req()Connection closed

Connection closed

This segment will not be delivered !

Page 30: 4 transport-sharing

Agenda

•Reliable transport

•Sharing resources

•Which resources need to be shared

•Medium Access Control

•Congestion Control

Page 31: 4 transport-sharing

Network resources

•What are the resources that are shared by multiple users inside a network ?

Page 32: 4 transport-sharing

Sharing bandwidth

•Several nodes on a single link

Page 33: 4 transport-sharing

Agenda

•Reliable transport

•Sharing resources

•Which resources need to be shared

•Medium Access Control

•Congestion Control

Page 34: 4 transport-sharing

How to share access to a link ?

•Deterministic solutions

•Probabilistic solutions

Page 35: 4 transport-sharing

Time Division Multiplexing

Page 36: 4 transport-sharing

ALOHA

Page 37: 4 transport-sharing

The collision problem

AB

collision

Page 38: 4 transport-sharing

Medium Access Control : ALOHAN=1;while ( N<= max) do

send frame;wait for ack on return channel or timeout:if ack on return channel

exit while;else

/* timeout *//* retransmission is needed */N=N+1;

end do/* too many attempts */

Page 39: 4 transport-sharing

CSMA

•Key idea

•Listen to the link before transmitting and only transmit when nobody else transmits

Page 40: 4 transport-sharing

CSMA/CD•Key idea

•Listen to link before transmitting

•Detect collisions

•If a collision occurs, stop transmitting

•Caveat

•Is it possible to detect all collisions ?

Page 41: 4 transport-sharing

CSMA/CA

•Key idea

•In wireless networks, we need to avoid collisions by deferring transmissions

•Possibility of “reserving” transmission slots

Page 42: 4 transport-sharing

Agenda

•Reliable transport

•Sharing resources

•Which resources need to be shared

•Medium Access Control

•Congestion Control

Page 43: 4 transport-sharing

Adapting to different

bandwidth

Page 44: 4 transport-sharing

Self-clocking

Page 45: 4 transport-sharing

The congestion problem

Page 46: 4 transport-sharing

Fairness

•What is the final objective of congestion control ?

•On a single link

•Fair share

•In a large network

•Max-min fairness

Page 47: 4 transport-sharing

Max-min fairness•a max-min allocation of bandwidth is an allocation of bandwidth which maximises the allocation of bandwidth to the sources receiving the smallest allocation

•a max-min fair allocation is such that in order to increase the bandwidth allocated to one source, it is necessary to decrease the bandwidth allocated to another source which already receives a lower allocation

Page 48: 4 transport-sharing

Congestion control

Page 49: 4 transport-sharing

Congestion control•Additive Increase / Multiplicative

Decrease

# Additive Increase Multiplicative Decreaseif congestion : rate=rate*betaC # MD, betaC<1else rate=rate+alphaN # AI

Page 50: 4 transport-sharing

How to detect congestion ?

•Host-based solutions

•Router-based solutions