Computer Networks and Internet Protocol (NPTEL) - Week 4
Computer Networks and Internet Protocol (NPTEL) - Week 4
INTERNET PROTOCOLS
SOUMYA K GHOSH SANDIP CHAKRABORTY
COMPUTER SCIENCE AND ENGINEERING, COMPUTER SCIENCE AND ENGINEERING,
IIT KHARAGPUR IIT KHARAGPUR
1
Transport Layer - VI (Performance)
Application Application
End to End Performance
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Bandwidth Delay Product
• Bandwidth Delay Product (BDP) = Link Bandwidth x Link Delay – an important metric
for flow control
• Consider Bandwidth = 50 Kbps, one way transit time (delay) = 250 msec
– BDP 12.5 Kbit
– Assume 1000 bit segment size; BDP = 12.5 segments
• Consider the event of a segment transmission and the corresponding ACK reception – this
takes a round trip time (RTT) – twice the one way latency.
• Maximum number of segments that can be outstanding during this duration = 12.5 x 2 =
25 segments
Bandwidth Delay Product – Implication on Window Size
• Maximum number of segments that can be outstanding within this duration = 25 +
1 (as the ACK is sent only when the first segment is received) = 26
– This gives the maximum link utilization – the link will always be busy in
transmitting data segments
• Let BD denotes the number of frames equivalent to the BDP, w is the maximum
window size
APPLICATION
USER
write(), send() Trigger
Periodically Transmission
Rate Control
KERNEL
TportSend()
KERNEL Transport
Buffer -
Interrupt Receiver TportRecv()
Data from
CheckBuffer() IP
Organizing Transport Buffer Pool
• If most segments are nearly the same size, organize the buffer as a pool of
identically sized buffers (one segment per buffer)
• For variable segment size – chained fixed sized buffer (buffer size = maximum
segment size)
1
Transport Layer - VII (Buffer Management and Congestion Control)
Application Application
Congestion Management
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Transport Buffer at the Receiver Side
• Sender should not send more data compared to receiver buffer space –
dynamically adjust the window size based on availability of receiver buffer space
Dynamic Buffer Management for Window Based Flow Control
• Receiver forwards available buffer space through ACK
Ensure that
the ACKs are
flowing in the
network
continuously
Congestion Control in the Network
• Consider a centralized network scenario – how can you maintain optimal
flow rates? 6
10 5 18
2 50
50
S D
2
20 11
4
Apply Max Flow Min Cut Theorem !
But this is hard in a real network …
Congestion Control in the Network
Source: Computer
Networks (5th Edition)
by Tanenbaum,
Wetherell Changing Bandwidth Allocation over Time
Congestion Control in the Network
• Flows enter and exit network dynamically – so applying an algorithm for
congestion control is difficult
Gradually increase the network rate Comes from flow control – receiver
and observe the effect on flow rates advertised window size for a sliding
(packet loss) window flow control
Network Congestion – Impact over Goodput and Delay
• A bad congestion control algorithm may affect fairness - Some flows can get
starved
• Let w(t) be the sending rate. a (a > 0) is the additive increase factor, and b
(0<b<1) is the multiplicative decrease factor
AIMD – Design Rationale (Two Flows Example)
Source: Computer
Networks (5th
Edition) by
Tanenbaum,
Wetherell
1
Transport Layer - VI (Primitives)
Application Application
End to End Transmission
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Transport Layer – Interfacing with Application and Network
Port Number
IP Address
Create a logical
pipe between the
sender and the
receiver and
monitor the data
transmission
through this pipe
Transport Service Primitives
• To allow users to access transport service, the transport layer must provide
some operations to the application programs.
SERVER
Source: Computer
Networks (5th Edition) by
Tanenbaum, Wetherell
Transport Layer Protocol – State Diagram
CLIENT
Source: Computer
Networks (5th
Edition) by
Tanenbaum,
Wetherell
Segment, Packet (or Datagram) and Frame
1
Transmission Control Protocol I (Primitives)
Application Application
Transmission Control Protocol
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
Transmission Control Protocol (TCP)
100 - 200
250 - 400
200 -250
Host A SOCKET Host B
read() write()
TCP Service Model
• A TCP connection is a byte stream, not a message stream
• Every byte on a TCP connection has its own 32 bit sequence number – a byte
stream oriented connection
• TCP uses sliding window based flow control – the acknowledgement number
contains next expected byte in order, which acknowledges the cumulative bytes
that has been received by the receiver.
– ACK number 31245 means that the receiver has correctly received up to
31244 bytes and expecting for byte 31245
TCP Segments
• The sending and receiving TCP entities exchange data in the form of
segments.
• TCP can accumulate data from several write() calls into one
segment, or split data from one write() into multiple segments
• Check the sender window after receiving an ACK. If the window size is
less than MSS, construct a single segment; otherwise construct multiple
segments, each equals to the MSS
Challenges in TCP Design
• Segments are constructed dynamically, so retransmissions do not
guarantee the retransmission of the same data segment – a
retransmission may contain additional data or less data
• The window size field tells how many bytes the receiver can receive based
on the current free size at its buffer space.
1
Transmission Control Protocol II (Connections)
Application Application
Transmission Control Protocol
Transport Transport
Network Network Network
Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical
TCP Connection Establishment
Host A Host A • How to choose the initial sequence
number?
– Avoid delayed duplicates, do now
generate the initial sequence number
for every connection from 0
– Original implementation of TCP used a
clock based approach, the clock ticked
every 4 microseconds, the value of the
clock cycles from 0 to 232-1. The value
of the clock gives the initial sequence
number
TCP Connection Establishment
Host A Host A
Timeout
TCP State Transition Diagram – Connection Modeling
Event/Action
Dashed: Server
Source: Computer Networks (5th Edition) by Tanenbaum, Wetherell Solid: Client
TCP State Transition Diagram – Connection Modeling
Event/Action
Source: Computer Networks Dashed: Server
(5th Edition) by Tanenbaum,
Wetherell Solid: Client
8