Error Flow Control
Error Flow Control
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
The most important functions of Data Link layer to satisfy the above
requirements are flow control and error control. Collectively, these
functions are known as data link control.
Flow Control
Stop-and-Wait
Sliding Window Protocol
Error Control
Stop & Wait ARQ
Sliding Window ARQ
Go-back-N ARQ
Selective-Repeat ARQ
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
Flow Control is a set of procedures that tells the sender how much data it
can transmit before it must wait for an acknowledgment from the
receiver.
The flow of data should not be allowed to overwhelm the receiver.
Receiver should also be able to inform the transmitter before its limits
(this limit may be amount of memory used to store the incoming data or
the processing power at the receiver end) are reached and the sender
must send fewer frames.
Hence, Flow control refers to the set of procedures used to restrict the
amount of data the transmitter can send before waiting for
acknowledgment.
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
There are two methods developed for flow control namely
◦ Stop-and-wait and Sliding-window.
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
This is the simplest form of flow control where a sender transmits a
data frame.
After receiving the frame, the receiver indicates its willingness to
accept another frame by sending back an ACK frame acknowledging
the frame just received.
The sender must wait until it receives the ACK frame before sending
the next data frame.
In LAN environment with fast links, this isn't much of a concern, but
WAN links will spend most of their time idle, especially if several hops
are required.
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
Request
S R
Ack
Ack
Efficiency (U) = 1 / 1 + 2a
Tp
Where Tp /Tt =a
With the use of multiple frames for a single message,
the stop-and-wait protocol does not perform well.
Only one frame at a time can be in transit. In stop-
and-wait flow control, if a > 1, serious inefficiencies
result.
Efficiency can be greatly improved by allowing
multiple frames to be in transit at the same time..
To keep track of the frames, sender station sends
sequentially numbered frames.
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
Tt = 1 ms
Tt
Tp = 1.5 ms
Efficiency (U) = 1 / 1 + 2a
Ta
3 2 1 0 0
1
4 3 2 1 0
2
5 4 3 2 1 0 3 A0
A1
In this way window will keep on 4
sliding, there will be no wait for A2
5
waiting of ACK. A3
In ACK loss, then it will be easy to re-
transmit packets from the same
window, now no waiting time Sliding window algorithm is a method
of flow control for network data
transfers. TCP, the Internet's stream
transfer protocol, uses a sliding window
algorithm.
https://www.youtube.com/watch?v=LnbvhoxHn8M
In a sliding window protocol, optimal sender window size = 1 + 2a
1 Sec 1/Tt
Source: https://www.gatevidyalay.com/sliding-window-protocol-flow-control/
Sliding window protocol is a flow control protocol.
It allows the sender to send multiple frames before needing the
acknowledgements.
Sender slides its window on receiving the acknowledgements for the
sent frames.
This allows the sender to send more frames.
It is called so because it involves sliding of sender’s window.
Source: https://www.gatevidyalay.com/sliding-window-protocol-flow-control/
The two well known implementations of sliding window
protocol are-
• Go back N Protocol
WR is always 1 in GBN.
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
• Go-Back-N : Here N is senders window size
• For E.g. N=4, it means 4 frames can be sent by the sender to the receiver before
expecting an Acknowledgement
• It use Pipelining, where sender can send multiple frames before expecting
Acknowledgement of first frame
• Sequential finite number of frames
• No of frames sent depends upon sender windows size.
• If the Ack of a frame is not received within a agreed upon time, all frames
in the current window are retransmitted
• The size of sending window decide sequence number of the outbound
frames
• E.g N = 4 (22), Seq no : 0,1,2,3, 0,1,2,3 …….
• Here no of bits used are 2 to generate the binary seq 00, 01, 10, 11
https://www.youtube.com/watch?v=QD3oCelHJ20
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
• We have sender window size of 4 (GB4)
• Now the sender has sent the packets 0, 1, 2 and 3. After acknowledging
the packets 0 and 1, receiver is now expecting packet 2 and sender
window has also slided to further transmit the packets 4 and 5
• Now suppose the packet 2 is lost in the network, Receiver will discard all
the packets which sender has transmitted after packet 2 as it is expecting
sequence number of 2
• On the sender side for every packet send there is a time out timer which
will expire for packet number 2.
• Now from the last transmitted packet 5 sender will go back to the packet
number 2 in the current window and transmit all the packets till packet
number 5.
• That’s why it is called Go Back N. Go back means sender has to go back N
places from the last transmitted packet in the unacknowledged window
and not from the point where the packet is lost.
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
Sender’s Windows ( Ws) = Receiver’s Windows ( Wr).
W=4 3210 0
• Suppose if packet 0 is not 1
received then negative ack is 2 X Lost
send to sender
3
• Sender will not wait for timer
to expire. Nack=0
• It immediately send the lost
packet
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
Error control: detection and correction of errors
We consider two types of errors:
◦ Lost frames
The receiver cannot recognize that this is a frame.
◦ Damaged frames
The receiver can recognize the frame, but some bits are in error.
Two approaches for error control
◦ ARQ: automatic repeat request, based on some or all of the following ingredients:
Error detection
Retransmission after timeout
Negative acknowledgement and retransmission
◦ FEC: forward error correction
References: Book Chapter 6 and 7 Data and Computer Communications, 8th edition, by William Stallings
When an error is detected in a message, the receiver sends a request to
the transmitter to retransmit the ill-fated message or packet
The most popular retransmission scheme is known as Automatic-
Repeat-Request (ARQ).
Such schemes, where receiver asks transmitter to re-transmit if it
detects an error, are known as reverse error correction techniques
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
Automatic repeat request (ARQ) is a protocol for error
control in data transmission.
When the receiver detects an error in a packet, it
automatically requests the transmitter to resend the packet.
This process is repeated until the packet is free from any
error.
This techniques uses acknowledgements and timeouts to
achieve reliable data transmission over an unreliable service
If the sender does not receive an acknowledgment before the
timeout, it usually re-transmits the frame/packet until the
sender receives an acknowledgment or exceeds a predefined
number of re-transmissions.
Three main types of the ARQ are:
Stop-and-wait ARQ
Go-Back-N ARQ
Selective Repeat ARQ.
Based on stop-and-wait flow control
The source station is equipped with a timer.
Source transmits a single frame, and waits for an ACK
If the frame is lost…
◦ The timer eventually fires, and the source retransmits the frame.
If receiver receives a damaged frame, discard it
◦ The timer eventually fires, and the source retransmits the frame.
If everything goes right, but the ACK is damaged or lost, the source will not
recognize it
◦ The timer eventually fires, the source will retransmit the frame
◦ Receiver gets two copies of the same frame!
◦ Solution: use sequence numbers, 1 bit is enough, i.e., frame0 and frame1, ACK0 and ACK1
Source:https://nptel.ac.in/content/storage2/courses/106105080/pdf/M3L3.pdf
Simple Stop and Wait
Sender:
Rule 1) Send one data packet at a time.
Rule 2) Send next packet only after
receiving acknowledgement for previous.
Receiver:
Rule 1) Send acknowledgement after
receiving and consuming of data packet.
Rule 2) After consuming packet
acknowledgement need to be sent (Flow
Control)
Source: https://www.geeksforgeeks.org/stop-and-wait-arq/
1. Lost Data
Source: https://www.geeksforgeeks.org/stop-and-wait-arq/
2. Lost
Acknowledgement:
Source: https://www.geeksforgeeks.org/stop-and-wait-arq/
3. Delayed
Acknowledgement/Data: After
timeout on sender side, a long
delayed acknowledgement might be
wrongly considered as
acknowledgement of some other
recent packet.
Delayed Acknowledgement:
This is resolved by introducing
sequence number for
acknowledgement also.
https://www.gatevidyalay.com/stop-and-wait-arq-sliding-window-protocols/
Source: https://www.geeksforgeeks.org/stop-and-wait-arq/
Stop and Wait ARQ (Automatic Repeat Request)
Above 3 problems are resolved by Stop and Wait ARQ (Automatic
Repeat Request) that does both error control and flow control.
Source: https://www.geeksforgeeks.org/stop-and-wait-arq/
Go-Back-N ARQ is a much more complex protocol.
It allows frames to be sent even if previous frames were
received without an acknowledgement signal.
This protocol keeps track of the sequence.
When the last frame is received, it requests re-transmission
of the frames sent without an acknowledgement.
This is repeated until all frames are received with an
acknowledgement signal
Based on sliding-window flow control
Use window size to control the number of unacknowledged frames
outstanding
If no error, the destination will send ACK as usual with next frame
expected (positive ACK, RR: receive ready)
If error, the destination will reply with rejection (negative ACK, REJ:
reject)
◦ Receiver discards that frame and all future frames, until the erroneous frame is
received correctly.
◦ Source must go back and retransmit that frame and all succeeding frames that
were transmitted in the interim.
◦ This makes the receiver simple, but decreases the efficiency
References: Book Chapter 6 and 7 Data and Computer Communications, 8th edition, by William Stallings
Selective Repeat ARQ may be used for the delivery and
acknowledgement of sent data packets
The protocol continues to accept and acknowledge frames sent
after an initial error.
It continues doing this until a specified number of frames have
been received, called window size.
There is a window size for both transmitting and receiving and
they must be equal.
The sequence numbers of all frames not received are tracked and
sent back to the transmitter.
Pros:
◦ Only rejected frames are retransmitted
◦ Subsequent frames are accepted by the receiver and buffered
◦ Minimizes the amount of retransmissions
Cons:
◦ Receiver must maintain large enough buffer, and must contain logic for
reinserting the retransmitted frame in the proper sequence
◦ Also more complex logic in the source
References: Book Chapter 6 and 7 Data and Computer Communications, 8th edition, by William Stallings
The Stop and Wait ARQ may cause big performance issues as
sender always waits for acknowledgement even if it has next
packet ready to send.
So Stop and Wait ARQ may work fine where propagation delay
is very less for example LAN connections, but performs badly
for distant connections like satellite connection
The stop-and-wait protocol follows a request and reply model. As
against, in sliding window protocol, the frames are spontaneously
transmitted for the specific window size.
Only one frame is transmitted at a time in the stop-and-wait
protocol while sliding window transmits more than one frame at a
time.
The efficiency of the sliding window protocol is more than the
stop-and-wait protocol.
Stop-and-wait protocol generates an acknowledgement at the
receiver end after receiving each frame whereas the
acknowledgement in the sliding window is produced after
receiving a particular set of frames.
Sliding window protocol effectively utilises the link. In contrast,
link utilisation in the stop-and-wait protocol is inferior.
Source: https://techdifferences.com/difference-between-stop-and-wait-protocol-and-sliding-
window-protocol.html
S.NO GO-BACK-N PROTOCOL SELECTIVE REPEAT PROTOCOL
In Go-Back-N Protocol, neither sender nor at In selective Repeat protocol, receiver side needs
5.
receiver need sorting. sorting to sort the frames.
https://www.geeksforgeeks.org/difference-between-go-back-n-and-selective-repeat-
protocol/
Link / Channel Efficiency / Utilization =
U = Tt/Tt+2Tp
U= 1/1+2a
Where Tt=Transmission Time
Tt = Length of Packet / Bandwidth
Tp = Propagation Time
a = Tp/Tt
Throughput = No. Of bits send per second
Throughput = Efficiency X Bandwidth
Link / Channel Efficiency / Utilization =
U = NTt/Tt+2Tp
U= N/1+2a
Where N= sender packet size (How many packets sender is going to send)
Where Tt=Transmission Time
Tt = Length of Packet / Bandwidth
Tp = Propagation Time
a = Tp/Tt
Throughput = No. Of bits send per second
Throughput = Efficiency X Bandwidth
Consider the use of 10 K-bit size frames on a 10 Mbps
satellite channel with 270 ms delay. What is the link
utilization for stop-and-wait ARQ technique?