Fourth lesson of the Computer Networking class. Covers reliable transport principles and the introduction for sharing resources (MAC and congestion control)
4. Multiplexing
Request
Client Server
Source port : 1234
Destination port: 5678
Source port : 5678
Destination port: 1234
Response
5. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
6. Connection
establishment
• How to reliably open a connection ?
Connect.req
Connect.ind
CR
Connect.conf Connect.resp
CA
Connection established
Connection established
7. Segment loss
Connect.req()
Connect.ind()
Connect.conf()
CA
Connection established
Connection established
CR
Retransmission CR
timer expires
Connect.resp()
8. Segments delayed
Connect.ind()
CR
Connect.conf() CA
CR
First connection established
Old previous CR
How to detect duplicates ?
Connect.req()
CA
D
Connect.resp
First connection established
First connection stopped First connection stopped
9. 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
10. Three way
handshake
Host A Host B
CR (seq=x)
CA (seq=y, ack=x)
CA (seq=x, ack=y)
Sequence number x read
from local transport clock
Local state :
Connection to B :
- Wait for ack for CR (x)
- Start retransmission timer
Sequence number y read from
local transport clock
CA sent to ack CR
Local state :
Connection to A :
- Wait for ack for CA(y)
Received CA acknowledges CR
Send CA to ack received CA
Local state :
Connection to B :
- established
- current_seq = x
The sequence numbers used
for the data segments will start
from x
The sequence numbers
used for the data segments
will start from y
D(x)
D(y)
Local state :
Connection to A :
- established
Connection established - current_seq=y
Connection established
11. Three way handshake
(2)
Host A CR (seq=z)
Host B
CA (seq=y, ack=z)
REJECT (ack=y)
Connection cancelled
No connection is established
Sequence number y read from
local transport clock
Acknowledges CR segment
Local state :
Connection to A :
- Wait for ack for CA(y)
Local state :
No connection to B
Send REJECT to cancel
connection establishment
12. Three way handshake
(3)
Host A Host B
CR (seq=z)
Current state does not contain
a CR with seq=x
CA (seq=y, ack=x)
REJECT (ack=y)
CR (seq=z) Retransmission timer
expires
CA (seq=w, ack=z)
CA (seq=z, ack=w)
Connection established
Sequence number z read
from local transport clock
Local state :
Connection to B :
- Wait for ack for CR (z)
- Start retransmission timer
Current state does not contain
a segment with seq=y
REJECT ignored
Sequence number w read from
local transport clock
CA sent to ack CR
Local state :
Connection to A :
- Wait for ack for CA(w)
Received CA acknowledges CR
Send CA to ack received CA
Local state :
Connection to B :
- established
- current_seq = z
13. Three way handshake
(4)
Host A Host B
Invalid CA received from A
Send REJECT
CR (seq=z)
CA (seq=w, ack=z)
REJECT (ack=w)
CA (seq=z, ack=y)
REJECT (ack=z)
Sequence number w read from
local transport clock
Acknowledges CR segment
Local state :
Connection to A :
- Wait for ack for CA(w)
Current state does not contain
a CR with seq=z
No connection is established
14. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
15. 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
16. Retransmission
policies
• Which retransmission policy in reliable
transport protocols ?
• Alternating Bit
• Go-back-n
• Selective repeat
17. 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
19. Buffer management
A B
Data.req(b)
Rwin=1
Receiver cannot handle
segment immediately
Data.ind(a)
Data.req(a)
D(0,a)
C(OK,0, w=0)
0 1 2 3
2 new buffers are
available
Swin=3, rwin=1
0 1 2 3
0 1 2 3
C(OK,0,w=3)
Lost segment
Swin=3, rwin=0
0 1 2 3
Window blocked
No 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
21. 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
25. Byte stream service (2)
A B
Data.req(abcdef)
Data.req(ijkl)
Data.req(mnop)
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 timer
Retransmission
D(6,ijklmnop)
C(OK,5) Data.ind(ijklmnop)
C(OK,13)
26. Agenda
• Reliable transport
• Multiplexing
• Connection establishment
• Data transfer
• Connection release
• Sharing resources
27. 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 !
29. Abrupt release
CR (seq=z)
CA (seq=w, ack=z)
CA (seq=z, ack=w)
Data.req() D
Data.ind()
Disc.req()
Data.req() D
DR
Disc.req()
Connection closed
Connection closed
This segment will not be delivered !
30. Agenda
• Reliable transport
• Sharing resources
• Which resources need to be shared
• Medium Access Control
• Congestion Control
31. Network resources
• What are the resources that are shared
by multiple users inside a network ?
38. Medium Access
Control : ALOHA
N=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 */
39. CSMA
• Key idea
• Listen to the link before transmitting
and only transmit when nobody else
transmits
40. 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 ?
41. CSMA/CA
• Key idea
• In wireless networks, we need to
avoid collisions by deferring
transmissions
• Possibility of “reserving” transmission
slots
42. Agenda
• Reliable transport
• Sharing resources
• Which resources need to be shared
• Medium Access Control
• Congestion Control
46. Fairness
• What is the final objective of congestion
control ?
• On a single link
• Fair share
• In a large network
• Max-min fairness
47. 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