Professional Documents
Culture Documents
Wireless and Mobile Computing: University of Gujrat
Wireless and Mobile Computing: University of Gujrat
Lecture #06,07
By
Hannan Bin Liaqat
Department of CS& IT
University of Gujrat
Lecture Agenda
Internet Protocol
Transport Control Protocol
TCP
Reliable transfer
flow control
connection management
principles of congestion control
TCP congestion control
OSI and Protocol stack
OSI Model TCP/IP Protocols
Hierarchy
7th
Application Layer
6th
Presentation Application Layer
Layer
5th
Session Layer
4th Transport Layer
Transport Layer
2nd
Link Layer
Link Layer
1st
Physical Layer
4
Overview of
Transmission Control Protocol / Internet Protocol
(TCP/IP)
5
Internet Protocol (IP)
6
Connection-Oriented
TCP is a connection oriented protocol
Connection oriented means that a virtual
connection is established with receiver before
any user data is transferred.
If the connection cannot be established - the
user program is notified.
If the connection is ever interrupted - the user
program is notified.
Conventional TCP
A transport layer protocol such as TCP has
been designed for fixed networks with fixed
end-systems.
packet loss rate is very low
if a packet on its way from a sender to a
receiver is lost in a fixed network, it is not
because of hardware or software errors.
The possible reason for a packet loss in a fixed
network is a temporary overload some point in
the transmission path ( i.e. congestion at a
node).
8
Conventional TCP….
The receiver send the ACK of all the in sequence
packets.
In case of any packet loss the sender notices the
missing acknowledgement for the lost packet and
assumes a packet loss due to congestion.
Retransmitting the missing packet and continuing
at full sending rate would now be unwise, as this
might only increase the congestion.
9
Conventional TCP…..
To mitigate congestion:
TCP slows down the transmission rate dramatically.
All other TCP connections experiencing the same
congestion, do exactly the same i.e slow down
transmision so the congestion is soon resolved.
This cooperation of TCP connections in the
internet is one of the main reasons for its survival
as it is today.
Under heavy load, TCP guarantees the
bandwidth sharing.
10
Window Based Flow Control
Congestion window size bounds the amount
of data that can be sent per round-trip time
11
Ideal Window Size
Ideal size = delay * bandwidth
delay-bandwidth product
13
Conventional TCP…..
Slow Start:
The sender sends one packet and waits for
acknowledgement. If this acknowledgement
arrives, the sender increases the congestion
window by one, now sending two packets (CW=2)
After arrival of the two corresponding ACKs the
sender again adds 2 to the congestion window, one
for each of the acknowledgements (CW=4)
This scheme doubles the congestion window
every time the acknowledgements come back,
which takes one round trip time (RTT).
14
Conventional TCP…..
Slow Start:
This is called the exponential growth of the
Threshold.
15
14 Congestion
avoidance
12
Congestion Window size
10
(segments)
17
Congestion window (segments) After timeout
25
cwnd = 20
20
15
10
ssthresh = 8 ssthresh = 10
5
22
0
9
12
15
20
25
Time (round trips)
18
Detecting Packet Loss Using Dupacks[duplicate
ack]
Dupacks may be generated due to
packet loss
19
Conventional TCP…..
Fast Retransmit/ Fast Recovery:
This mechanism allows TCP to avoid a lengthy timeout
during which no data is transferred.
Fast Retransmit is an enhancement to TCP which reduces
the time a sender waits before retransmitting a lost
segment.
When 3 duplicate ACKs are received, sender retransmits
the lost segment without waiting for timer to expire
At the same time, ssthresh is set to one half of the current
congestion window, i.e., cwnd and cwnd is set to ssthresh
plus three segments.
20
Conventional TCP…..
Fast Retransmit/ Fast Recovery:
If the ACK is received approximately one round trip after the
missing segment is retransmitted, fast recovery is entered.
That is, instead of setting cwnd to one segment and starting
with slow start,
TCP sets cwnd to ssthresh, and then steps into congestion
avoidance phase
The sender can continue with the current congestion window.
The sender performs a fast recovery from the packet loss.
This mechanism can improve the efficiency of TCP
dramatically.
However, only one packet loss can be recovered during fast retransmission
and fast recovery. Additional packet losses in the same window may
require that the RTO expire before retransmission.
21
Conventional TCP…..
Fast Retransmit/ Fast Recovery:
The other reason for activating slow start is a time-
out due to a missing acknowledgement.
TCP using fast retransmit/fast recovery interprets
this congestion in the network and activates the
slow start mechanism.
22
Fast Recovery
ssthresh =
min(cwnd, receiver’s advertised window)/2
retransmit the missing segment (fast retransmit)
cwnd = ssthresh + number of dupacks
when a new ack comes: cwnd = ssthresh
enter congestion avoidance
23
After fast recovery
10
Receiver’s advertised window
8
Window size (segments)
6
4
2
0
25