When the receiver is overwhelmed with data we said that the sender window size is determined by the available buffer space in the receiver if the network cannot deliver the data as fast as they are created by the sender. It must tell the sender to slow down.
TCP’s general policy for handling congestion is based on slow start, congestion avoidance and congestion detection.
This is the first step in congestion control now a days packet loss due to transmission error is very rare due to the use of optical fiber link so most transmission time outs (loss of packets) due congestion.
So all internal TCP algorithm assume that time outs are caused by congestion.
After establishing a connection, suitable window size is to be chosen, the receiver window size is based on its buffer capacity, if the sender adjusts it’s transmission rate to suit for this capacity, the congestion due to buffer overflow will never take place.
Now consider the sender is slow the receiver has a large buffer capacity but the problem is internal carrying capacity of the network.
If the sender is to 0 fast the water will back up and some will be lost (loss of packet) and congestion will take place.
To prevent congestion TCP has to deal with two problems separately, receiver capacity and network capacity.
To deal with the two problem mentioned earlier each sender maintains two window the window the receiver has granted (indicating the receiver capacity) and the congestion window (indicating network capacity)
Each window reflects the number of bytes the sender mat transmit. The number of bytes that may be sent by the sender is the minimum of the two windows.
So the effective window is the minimum of what the sender and receiver both think is all right.