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

CSU07204.Lecture 8.Data Link Layer -Flow and Error Control

The document discusses flow control and error control in the Data Link Layer, highlighting methods such as Stop-and-Wait and Sliding Window for managing data transmission. It explains the importance of acknowledgments (ACK) and negative acknowledgments (NAK) in ensuring data integrity, along with Automatic Repeat Request (ARQ) mechanisms for error handling. Additionally, it covers Go-Back-N and Selective Reject ARQ protocols for retransmitting lost or damaged frames, emphasizing their operational differences and requirements.

Uploaded by

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

CSU07204.Lecture 8.Data Link Layer -Flow and Error Control

The document discusses flow control and error control in the Data Link Layer, highlighting methods such as Stop-and-Wait and Sliding Window for managing data transmission. It explains the importance of acknowledgments (ACK) and negative acknowledgments (NAK) in ensuring data integrity, along with Automatic Repeat Request (ARQ) mechanisms for error handling. Additionally, it covers Go-Back-N and Selective Reject ARQ protocols for retransmitting lost or damaged frames, emphasizing their operational differences and requirements.

Uploaded by

Craig Calvin
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Data Link Layer:

Flow Control and Error Control


Flow and Error Control
Flow Control
• Flow control refers to a set of procedures used to restrict the
amount of data that the sender can send before waiting for
acknowledgment (ACK) from the receiver

• The flow of data must not be allowed to overwhelm the receiver

• The receiving device should be able to inform the sender before


limits (processing speed limit and temporal storage limits) are
reached and request that the sender sends fewer frames or stop
temporarily.
▪ The rate of processing is often slower than the rate of
transmission. The receiver has a block of memory
called buffer, reserved for storing incoming data until
they are processed.

▪ Two method to the flow of data across communication


link are Stop-and-wait and sliding window
Categories of flow control
Stop-and-Wait

▪ In Stop-and-Wait method of flow control, the sender waits

for an acknowledgement (ACK) after every frame it sends.

▪ When an acknowledgement has been received it send the

next frame.

▪ This process of alternately sending and waiting repeats until

the sender transmits an end of transmission (EOT) frame.


Stop-and-Wait
Stop-And-Wait

Frame types
▪ Data: Contain information to be sent
▪ ACK: Acknowledges receipt of data
Rules:
▪ Source transmits Data frame
▪ Source waits for ACK frame before sending next Data frame
▪ Destination receives Data frame and replies with ACK frame
if ready for more
▪ Destination can stop flow of data by not sending ACK frame
Stop-And-Wait…..cont

▪ Advantage of Stop- and -Wait


Simplicity: Each frame is checked and acknowledged
before the next frame is sent

▪ Disadvantage of Stop-and-Wait
Inefficiency: Stop-and-wait is slow. Each frame must travel all the
way to the receiver and the acknowledgement must travel all the
way back before the next frame can be sent
Sliding window

▪ In sliding window method, multiple frames are sent


by sender at a time before needing an
acknowledgment.

▪ Multiple frames sent by source are acknowledged by


receiver using a single ACK frame.
Sliding Window
• Sliding window refers to an imaginary boxes that hold
the frames on both sender and receiver side.
• It provides the upper limit on the number of frames that
can be transmitted before requiring an
acknowledgment.
• Frames may be acknowledged by receiver at any point
even when window is not full on receiver side.
• Frames may be transmitted by source even when
window is not yet full on sender side.
Sliding Window

• The windows have a specific size in which the frames


are numbered modulo- n, which means they are
numbered from 0 to n-l. For e.g. if n = 8, the frames
are numbered 0, 1,2,3,4,5,6, 7, 0, 1,2,3,4,5,6, 7, 0, 1, ....
• The size of window is n-1. For e.g. In this case it is 7.
Therefore, a maximum of n-l frames may be sent
before an acknowledgment.
• When the receiver sends an ACK, it includes the number of next
frame it expects to receive. For example, in order to
acknowledge the group of frames ending in frame 4, the receiver
sends an ACK containing the number 5. When sender sees an

ACK with number 5, it comes to know that all the frames up to

number 4 have been received.

• The window can hold n-1 frames at either side; therefore, a

maximum of n-1 frames may be sent before an


acknowledgement is required.
Example of Sliding Window
Error control
▪ When data-frame is transmitted, there is a probability that data-
frame may be lost in the transit or it is received corrupted.
▪ In both cases, the receiver does not receive the correct data-frame
and sender does not know anything about any loss.
▪ In such case, both sender and receiver are equipped with some
protocols which helps them to detect transit errors such as loss of
data-frame.
▪ Either the sender retransmits the data-frame or the receiver may
request to resend the previous data-frame.
Error Control -Refers to procedures to detect and correct errors

➢ Requirement for error control mechanism:


▪ Error detection
▪ Positive Acknowledgement (ACK): if the frame arrived with no
errors
▪ Negative Acknowledgement (NAK): if the frame arrived with
errors
▪ Retransmissions after timeout: Frame is retransmitted after certain
amount of time if no acknowledgement was received
▪ These actions are called Automatic Repeat Request (ARQ)
Error Control
❑ Automatic Repeat Request (ARQ)

▪ ARQ: anytime an error is detected in an exchange, a negative


acknowledgement is returned (NAK) and the specified frame is
retransmitted.
▪ ARQ’s main function is the retransmission of damaged frames
and lost frames including lost ACK and NAK – where the loss is
detected by the sender instead of the receiver.

➢ There are three types of techniques available which Data-link


layer may deploy to control the errors by ARQ
Error Control
Stop-and-Wait ARQ

▪ In Stop-and-Wait ARQ, Stop-and-Wait is extended to include


retransmission of frames in case of lost or damaged frames

For retransmission to work four features are required:

1. The sending device keeps a copy of last frame transmitted until it


receives acknowledgement of that frame.
2. For identification purpose, both data frame and ACK frames are
numbered alternately 0 and 1.
3. If an error is discovered in a data frame, indicating that it had
been corrupted in the transit, a NAK frame is returned. NAK is
not numbered and it tells the sender to retransmit the last sent
frame
Stop-and-Wait ARQ

4 The sending device is equipped with timer. If an expected


acknowledgement is not received within an allotted time period,
the sender assumes that the last data frame was lost in transit
and sends again
Stop-and-Wait ARQ, damaged data frame
Stop-and-Wait ARQ, lost data frame
Stop-and-Wait ARQ, lost ACK frame
The following transition may occur in Stop-and-Wait ARQ:
1. The sender maintains a timeout counter.
2. When a frame is sent, the sender starts the timeout counter.
3. If acknowledgement of frame comes in time, the sender
transmits the next frame in queue.
4. If acknowledgement does not come in time, the sender
assumes that either the frame or its acknowledgement is
lost in transit. Sender retransmits the frame and starts the
timeout counter.
5. If a negative acknowledgement is received, the sender
retransmits the frame.
Sliding Window ARQ
To extend sliding window to cover retransmission of lost or
damaged frames, three features are added to the basic flow
control mechanism

1. The sending device keeps copies of all transmitted frames


until they have been acknowledged.
2. Since sliding window is continuous transmission mechanism,
ACK and NAK frames must be number for identification.
3. The sending device in sliding window ARQ is equipped with
a timer to enable it to handle lost acknowledgment
Go-back-in

"Go-back-N" Protocols

▪ When errors occur in a continuous ARQ protocol, the

simplest solution is to repeat the frame in error and all

subsequent frames, thus:


How it works
▪ In Go-Back-N ARQ method, both sender and receiver maintain a
window.
▪ The sending-window size enables the sender to send multiple
frames without receiving the acknowledgement of the previous
ones. The receiving-window size enables the receiver to receive
multiple frames and acknowledge them. The receiver keeps track
of incoming frame’s sequence number.
▪ When the sender sends all the frames in window, it checks up to
what sequence number it has received positive acknowledgement.
If all frames are positively acknowledged, the sender sends next set
of frames. If sender finds that it has received NACK or has not
receive any ACK for a particular frame, it retransmits all the
frames after which it does not receive any positive ACK.
Go-back-n, damaged data frame
Go-back-in, lost data frame
Go-back-in, lost ACK
Selective-reject ARQ

Selective Reject
An alternative approach is to only repeat those frames received in
error. This is more complicated and is rarely implemented,
despite having the attraction of apparently greater efficiency.
Problems with selective reject include:
1. Receiver must have storage to save post-NAK frames until the
erroneous frame is received, and logic to re-insert it in the
correct sequence.
2. The sender must be able to send frames out of sequence.
3. The window size for a given size of sequence number is
somewhat less than for go-back-N.
Selective-reject, damage data frame
Lost Frames
Lost Acknowledgment
▪ Lost ACK and NAK frames are treated by selective-reject
ARQ just as they are by Go-back in ARQ.
➢ When the sending devices reaches either the capacity of
its window or the end of transmission, it sets a timer.
➢ If no acknowledgement arrives in the time allotted , the
sender retransmits all the frames that remain
unacknowledged.
➢ In case the receiver recognize any duplications, it will
discard them.

You might also like