0% found this document useful (0 votes)
80 views

Error Flow Control

The document discusses data link layer protocols for reliable data transmission between networked devices. It describes flow control mechanisms like stop-and-wait and sliding window protocols that ensure a fast sender does not overwhelm a slow receiver. It also covers error control using techniques like CRC, checksums, and ARQ protocols to detect and correct errors during transmission. The key aspects of sliding window protocols are discussed in detail, including how they allow sending multiple frames before needing acknowledgement to improve efficiency over stop-and-wait.

Uploaded by

Mohd Shifan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Error Flow Control

The document discusses data link layer protocols for reliable data transmission between networked devices. It describes flow control mechanisms like stop-and-wait and sliding window protocols that ensure a fast sender does not overwhelm a slow receiver. It also covers error control using techniques like CRC, checksums, and ARQ protocols to detect and correct errors during transmission. The key aspects of sliding window protocols are discussed in detail, including how they allow sending multiple frames before needing acknowledgement to improve efficiency over stop-and-wait.

Uploaded by

Mohd Shifan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

 Hop to Hop Delivery

 Flow Control (Stop &


wait, Go-Back-N, Sliding
Window Protocols)
 Error Control (CRC,
Checksum)
 Access Control
(MAC)
 Physical Addressing
 Framing https://www.youtube.com/watch?v=JRgmPco0KWI
 For reliable and efficient data communication a great deal of
coordination is necessary between at least two machines.
 Some of these are necessary because of the following
constraints:
◦ Both sender and receiver have limited speed
◦ Both sender and receiver have limited memory
 It is necessary to satisfy the following requirements:
◦ A fast sender should not overwhelm a slow receiver, which must
perform a certain amount of processing before passing the data on to
the higher-level software.
◦ If error occur during transmission, it is necessary to devise mechanism
to correct it

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.

 Stop-and-wait is also known as Request/reply sometimes.


Request/reply (Stop-and-wait) flow control requires each
data packet to be acknowledged by the remote host before
the next packet is sent.
 Sliding window algorithms, permit multiple data packets to
be in simultaneous transit, making more efficient use of
network bandwidth

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

Transmission Time (Tt)-Time taken


by a station to transmit a frame
Tt
Propagation Time (Tp)-Time it takes
for a bit to travel from sender to
Tp
receiver
Ta

Total Time (T)= Tt + Tp + Ta + Tp

Total Time (T)= Tt + 2Tp


Tp
Ta = 0

2Tp is Round Trip Time


Request
S R

Ack

Total Time (T)= Tt + Tp + Ta + Tp

Tt Total Time (T)= Tt + 2Tp Ta = 0

Tp Efficiency (U) = Useful Time /Total Time


Ta
Efficiency (U) = Tt /Tt + 2Tp

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

Efficiency (U) = 1/1+2*1.5

Efficiency (U) = 1/4 Where a = T p / Tt


Ta = 0

Efficiency (U) = useful time


Wastage = 3 ms / Total Time
• Send Multiple frames at a time

• Number of frames to be sent is based on Window Size

• Each frame is numbered – Sequence Number


Window

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

Tt Sec 1 Frame sent

1 Sec 1/Tt

Total Time (Tt + 2Tp ) Tt + 2Tp


Tt
1 + 2a Where a = Tp / Tt

•In time Tt, sender sends one frame.


•Thus, In time Tt + 2Tp, sender can send (Tt + 2Tp) / Tt frames i.e. 1+2a
frames.

Thus, to achieve 100% efficiency, window size of the sender must be


1+2a.

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.

Maximum number of frames that sender can send without acknowledgement


= Sender window size

In a sliding window protocol, optimal sender window size = 1 + 2a

Source: https://www.gatevidyalay.com/sliding-window-protocol-flow-control/
 The two well known implementations of sliding window
protocol are-

• Go back N Protocol

• Selective Repeat Protocol


Example:

Tt = 1 msec Tp = 49.5 msec GB10

Sender sends 10 packets and receiver window size is 1.

Efficiency (U) = useful time


Efficiency (U) = 10/1+2*49.5 / Total Time

Efficiency (U) = N/1+2a


Efficiency (U) = 10/100 = 10% only
1. Sender Window Size (WS)

It is N itself. If we say the protocol is GB10, then Ws = 10. N should be


always greater than 1 in order to implement pipelining. For N = 1, it reduces
to Stop and Wait protocol.

2. Receiver Window Size (WR)

WR is always 1 in GBN.

Efficiency (U) = N/1+2a

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

It takes the advantage of Stop & Wait and


Go-back-N both.
Do not send all
Not wait for Ack Efficiency (U) = N/1+2a
packets, only resend
send all packets
lost packet
Source :https://www.geeksforgeeks.org/sliding-window-protocol-set-2-receiver-side/
https://www.youtube.com/watch?v=WfIhQ3o2xow
https://www.youtube.com/watch?v=WfIhQ3o2xow
Acknowledgements

There are 2 kinds of acknowledgements namely:

Cumulative Ack: One acknowledgement is used for many packets. The


main advantage is traffic is less. A disadvantage is less reliability as if
one ack is the loss that would mean that all the packets sent are lost.

Independent Ack: If every packet is going to get acknowledgement


independently. Reliability is high here but a disadvantage is that traffic
is also high since for every packet we are receiving independent ack.

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, if the sent frame are


find suspected then all the frames are re- In selective Repeat protocol, only those frames are
1.
transmitted from the lost packet to the last re-transmitted which are found suspected.
packet transmitted.

Sender window size of selective Repeat protocol is


2. Sender window size of Go-Back-N Protocol is N.
also N.
Receiver window size of Go-Back-N Protocol is Receiver window size of selective Repeat protocol is
3.
1. N.

4. Go-Back-N Protocol is less complex. Selective Repeat protocol is more complex.

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.

Efficiency of Go-Back-N Protocol is Efficiency of selective Repeat protocol is also


6.
N/(1+2*a) N/(1+2*a)
In Go-Back-N Protocol, type of In selective Repeat protocol, type of
7.
Acknowledgement is cumulative. Acknowledgement is individual.

https://www.geeksforgeeks.org/difference-between-go-back-n-and-selective-repeat-
protocol/
 Link / Channel Efficiency / Utilization =

 U = Useful Time/Total Time

 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 = Useful Time/Total Time

 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?

Ans: Link utilization = 1 / (1+2a)


Where a = (Propagation Time) / (Transmission Time)
Propagation time = 270 msec
Transmission time = (frame length) / (data rate) = (10 K-bit) /
(10 Mbps) = 1 msec
Hence, a = 270/1 = 270
Link utilization = 1/(1+2*270) ≈0.0018 =0.18%

You might also like