Flow Control, Access Control & Error Control

Flow Control, Access Control & Error Control

Flow Control

What is Flow Control?

Sometimes the receiver's processor is slow and cannot process the data at the speed the sender is sending. If the queue(buffer) of the receiver is full then it starts discarding the signals. Flow control methods are used to assure that the sender sends the signal only if the receiver is in a condition to receive it.

Types of delays

Transmission Delay

It is the time taken to transfer a packet from the host to the outgoing link.

Tt =   L / B

L is the size of the packet.

B is the Bandwidth of the Bandwidth of the transmission medium.

For example, if bandwidth is 1 bps (every second 1 bit can be transmitted onto the transmission medium) and data size is 20 bits then what is the transmission delay? If in one second, 1 bit can be transmitted. To transmit 20 bits, 20 seconds would be required.

Note: Data is always is powers of 2 and Bandwidth is always in powers of 10. This is because Bandwidth is dependent on frequency and frequency is measured in decimal. Data is measured in bits.

Propagation Delay

It is the time taken by the signal to reach from one end of the link to the other end of the link.

Tp =   Distance / Velocity

Queuing Delay

When the packet is received at the destination it will not be processed immediately. All the packets will sit in a queue. This is called queuing delay. When the receiver has processing time, the packets will be taken one by one from the queue.

Processing Delay

It is the time taken to process the signal.

Both queuing delay and processing delay doesn’t have any formula because they depend upon the speed of the processor of the receiver.

Total Time

Tt + Tp + Tqueue + Tprocessing

Flow Control Methods

Stop & Wait

It is the simplest flow control mechanism. The sender sends one packet and then stops and waits until the receiver confirms that it can send the next one.

Total time is

Tt Data + Tp Data + Tqueue + Tprocessing + Tt Acknowledgement + Tp Acknowledgement

Tt Data Transmission time for data

Tp Data Propagation time for data

Tt Acknowledgement Transmission time for acknowledgement

Tp Acknowledgement Propagation time for acknowledgement

Tp Data is the same as Tp Acknowledgement

Total time is Tt Data + Tqueue + Tprocessing + Tt Acknowledgement + 2Tp

Size of acknowledgement << Size of data

Hence, we can ignore Tt Acknowledgement

Total time is Tt Data + Tqueue + Tprocessing + 2Tp

Queuing delay (Tqueue) and processing delay (Tprocessing) are also negligible.

Total time is Tt Data + 2Tp

We stop and wait for "2Tp" Hence, this is inefficiency.

Throughput: Number of bits we are able to send per second. Sometimes throughput is also called effective bandwidth or bandwidth utilization.

Throughput = L / (Tt Data + 2Tp)

Disadvantages of stop and wait

  • Efficiency is not very high and decreases with certain factors. It is good for LAN but not WAN.

  • The problem arises when a data packet is lost. The sender will think that the receiver has received the data but is busy. The receiver keeps waiting for the sender to send the data. Hence both the sender and the receiver go into a deadlock. A solution to this is a time-out timer. Within this time if the receiver doesn't get an acknowledgement then it considers that data is lost and retransmits the data. This is called the stop-and-wait automatic repeat request.

  • Acknowledgement can be lost or duplicate packet problems. If the acknowledgement is lost then after the time-out timer the sender retransmits the data packet and the receiver thinks that it is a different data packet. Hence, the receiver accepts the duplicate packet as a new data packet. To solve this we have a sequence number on the data which helps to identify data uniquely.

    Miminum swquence number required to avoid duplicate packet problem is

    WS + WR

    WS = Sender window size

    WR = Receiver window size

  • To solve the delayed acknowledgement problem we number the acknowledgements. Acknowledgements have a number of the data byte expected next.

Sliding Window

Pipelining

Tt Data sec = 1 packet is sent

1 sec = 1 / Tt Data packet is sent

Tt Data + 2Tp   sec = (Tt Data + 2Tp ) / Tt Data packet is sent = 1 + 2a packets

Hence, we could have transmitted 1 + 2a packets in Tt Data + 2Tp   sec.

To increase efficiency, we have to increase the number of packets sent. Instead of sending 1 packet and waiting for the acknowledgement, we send a window of packets.

The window is the buffer used to hold the packets. The way the window is moving, it is actually sliding. Hence, it is called the sliding window protocol.

For maximum utilization, the sender window size should be (1 + 2a).

The sequence number is stored in the header field. A larger sequence number means space taken up by the header will also be high. Hence to decrease the header size, the sequence number should be as less as possible.

Ws = min ( 1+2a, 2N)

Ws is the Sender window size

N is the number of bits in the sequence number field

2N is the Number of sequence numbers possible with N bits

Sliding window protocol is a theoretical concept. It is practically implemented as:

  • Go Back N (GBN)

  • Selective Repeat (SR)

Go Back N

Ws is N and WR is N

Ws means the Sender window size

WR means the Receiver window size

If a time-out occurs at any point on the sender side, we go back to N and retransmit the entire window again. We go back to N from the point where the last packet was being transmitted and not from the lost one. Hence, it is called Go Back N.

GBN uses cumulative acknowledgement. The receiver side has an acknowledgement timer. For all the packets received during this time one acknowledgement is sent. The acknowledgement timer should not be too large otherwise on the other side there will be a timeout.

Time-out timer (sender side) > Acknowledgement timer (receiver side)

Selective Repeat (SR)

Here, only the erroneous or lost frames are retransmitted, while the good frames are received and buffered.

WS > 1 and WR = WS

The Comparison

Stop and WaitGo Back NSelective repeat
Efficiency1 / (1+2a)N / (1+2a)N / (1+2a)
BuffersWR = WS = 1WS = N and WR = 1WR = WS = N
Number of unique Sequence numbers required to avoid duplicate packet problem = WS + WR1N + 1N + N
Number of Retransmissions if 1 packet lost1N1
Bandwidth (Transmission + Retransmission)lowhigh (as the number of retransmissions is high)moderate
CPUlowmoderate (Receiver never gets out-of-order packets. No sorting and searching required.)High (Packets can arrive in any order. Hence, sorting is required. Searching is also required to find out which packets are lost.)
Implementationlowmoderatecomplex
AcknowledgementIndependentCumulative (Discard packet if out-of-order as the receiver always waits for 1 packet. It also discards the packet if corrupted. Time-out occurs on the sender side and the entire window is retransmitted.)Independent (Negative acknowledgement is sent if the packet is corrupted. Hence we don't have to wait for time-out to occur and the packet is retransmitted earlier.)
Acknowledgement timerNoYesNo

Access Control

When we have a broadcast channel, only one station should send the data. If more than one station is sending the data then there should be no collisions inside the channel.

Access Control Methods

Time Division Multiplexing

The timeline is divided into slots and each slot is allocated to each station in a Round Robin manner.

How much time to give to each station?

The last bit transmitted by it should get out of the link

Total time = Tt + Tp

Disadvantage: The station might not use the slot allocated to it completely as it might not have nay data to send.

Polling

  • A poll is conducted in which all the stations willing to send data participate.

  • The polling algorithm chooses one of the stations to send the data.

  • The chosen station sends the data to the destination.

  • After the chosen station has sent the data, the cycle repeats.

Total time is Tt + Tp+ Tpoll

Advantage: No slots wasted

Disadvantage:

  • Not a fair sharing

  • Starvation may occur

  • Extra polling time required

CSMA/CD

Carrier Sensing

  • Any station that is willing to transmit the data senses the carrier.

  • If it finds the carrier free, it starts transmitting its data packet otherwise not.

Multiple Access: Many stations are trying to access the channel (Broadcast channel)

Collision Detection: The sender should be able to detect if it's packet got involved in a collision and retransmit.

How can the sender detect if the collision signal coming back is because of it's own packet?

If the data packet is long enough and while the sender is till transmitting the data the collision signal comes.

Tt >= 2TP

L >= 2TP B

Back Off Algorithm is used to assign waiting time to the stations.

Refer to the resources for:

Token Passing

Aloha

The Comparison

Access Control MethodResourceEfficiency
Time Division MultiplexingTime Division Multiplexing1 / (1+a)
PollingPolling in NetworkingTt / (TPoll + Tt + Tp)
CSMA/CDCSMA-CD1 / (1 + 6.44a)
Token PassingToken passing(N x Tt) / (Tp + N x THT); THT = Token Holding Time
AlohaAlohaPure Aloha (η) = G x e-2G, Slotted Aloha (η) = G x e-G

Error Control

When many packets are sent to the receiver, the buffer might get filled up and the remaining packets are discarded. Another reason for errors is that we will receive the packet but a few bits will be corrupted. This can happen due to some external disturbance while the packet is being transmitted.

Error Detection

Error correction

Here, we only know that the packet got corrupted but we don't know which bits got corrupted. We cannot self-correct it and hence ask for retransmission.

Here, we know where the error is in the packet and hence we can self-correct it.

Error control Methods

Hamming Distance (d)

Hamming distance between two points is the number of bits that are different at the same position. Let "d" be the hamming distance between 2 points "a" and "b".

d = a XOR b

To detect x bit error we need, d = x + 1

To correct x bit error we need, d = 2x + 1

Comparison

Where they take place

  • Transport layer: Flow control and Error control

  • Data link layer: Access control, flow control and error control

Flow control vs Access control

We first apply access control methods to get access to the channel link followed by the flow control methods to stop the receiver from overflowing.

Resources

Did you find this article valuable?

Support Arunima Chaudhuri by becoming a sponsor. Any amount is appreciated!