Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

Wireless and Mobile Computing

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

3rd Network or Internet


Network Layer Layer

2nd
Link Layer
Link Layer
1st
Physical Layer

 Link Layer : includes device driver and network interface card


 Network Layer : handles the movement of packets, i.e. Routing
 Transport Layer : provides a reliable flow of data between two hosts
 Application Layer : handles the details of the particular application
Packet Encapsulation
 The data is sent down the protocol stack
 Each layer adds to the data by prepending headers

4
Overview of
Transmission Control Protocol / Internet Protocol
(TCP/IP)

5
Internet Protocol (IP)

 Packets may be delivered out-of-order

 Packets may be lost

 Packets may be duplicated

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

 Throughput <= CW / RTT

 Throughput is the number of Packets successfully delivered per


unit time measured in Bits per second (Bps)
 RTT: When a sender transmits a TCP packet to its receiver, it
must wait a period of time for an acknowledgment.

11
Ideal Window Size
 Ideal size = delay * bandwidth
 delay-bandwidth product

 What if window size < delay*bw ?


 Inefficiency (wasted bandwidth)
 What if size > delay*bw ?
 Queuing at intermediate routers
 increased RTT due to queuing delays
 Potentially, packet loss 12
Conventional TCP…..
Slow Start:
 TCP’s reaction to a missing acknowledgement is
quite drastic, but it is necessary to get rid of
congestion quickly.
 The behavior TCP shows after the detection of
congestion is called slow start.
 The sender always calculates a congestion
window for a receiver. The start size of the
congestion window is one segment (TCP packet).

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

congestion window in the slow start mechanism.


 It is too dangerous to double the congestion
window each time because the steps might become
too large.
 The exponential growth stops at the Congestion

Threshold.

15
14 Congestion
avoidance
12
Congestion Window size

10
(segments)

8 Slow start threshold


6Slow start
4
2
0
0 1 2 3 4 5 6 7 8
Time (round trips)

Example assumes that acks are not delayed


16
Conventional TCP…..
Congestion Avoidance/ Linear Increase:
 As soon as the congestion window reaches the
congestion threshold, further increase of the
transmission rate is only linear by adding 1 to the
congestion window each time the ACK come back.

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

 out-of-order packet delivery

 TCP sender assumes that a packet loss has


occurred if it receives three dupacks
consecutively

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

Congestion window cut into half

23
After fast recovery

10
Receiver’s advertised window
8
Window size (segments)

6
4
2
0

Time (round trips)

After fast retransmit and fast recovery window size


is
reduced in half. 24
Conventional TCP…..
 Summary:
 Reliable ordered delivery
 Implements congestion avoidance and control
 Reliability achieved by means of
retransmissions if necessary
 End-to-end semantics
 Acknowledgements sent to TCP sender confirm
delivery of data received by TCP receiver
 Ack for data sent only after data has reached
receiver

25

You might also like