Congestion window and a congestion policy that avoid congestion is used by TCP at transport layer.
If the network cannot deliver the data as fast as it is created by the sender, it must tell the sender to slow down. In other words, in addition to the receiver, the network is a second entity that determines the size of the sender’s window.
TCP congestion control Algorithm
Slow Start Phase: starts slowly with 1MSS and grow till the threshold in exponential manner.
Congestion Avoidance Phase: After reaching the threshold increment is by 1 till you reached the max receiver window size.
Congestion Detection Phase: Sender goes back to Slow start phase or Congestion avoidance phase.i.e
1) Retransmission due to Timeout – In this case congestion possibility is high.
(a) ssthresh is reduced to half of the current window size.
(b) set cwnd = 1
(c) start with slow start phase again.
2) Retransmission due to 3 Acknowledgement Duplicates – In this case congestion possibility is less.
(a) ssthresh value reduces to half of the current window size.
(b) set cwnd= ssthresh
(c) start with congestion avoidance phase
1 2 4 8 16 32(threshold arrive) 33 34 35 ------------------------------64
now suppose at MSS 34 TO occure then Threshold =floor(Wc/2)
i.e 17 now slow start phase start with threshold 17
1 2 4 8 16 17 18 19 20
now at MSS 20 3 duplicate acknowldegement occure the threshold =floor(Wc/2)
sender window size will be equl to threshold i.e 10 and start in congestion Avoidance phase
10 11 12 13...........................