Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views38 pages

Module 2.2

The document provides an overview of Data Link Layer (DLL) protocols, focusing on mechanisms for reliable frame delivery, including acknowledgements and timeouts, which are essential for protocols like Automatic Repeat reQuest (ARQ). It discusses various protocols such as Stop and Wait, Go Back N, and Selective Repeat, explaining their features, advantages, and disadvantages. The document also includes examples and scenarios to illustrate the functioning of these protocols in managing frame transmission and error handling.

Uploaded by

joseph.vayalattu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views38 pages

Module 2.2

The document provides an overview of Data Link Layer (DLL) protocols, focusing on mechanisms for reliable frame delivery, including acknowledgements and timeouts, which are essential for protocols like Automatic Repeat reQuest (ARQ). It discusses various protocols such as Stop and Wait, Go Back N, and Selective Repeat, explaining their features, advantages, and disadvantages. The document also includes examples and scenarios to illustrate the functioning of these protocols in managing frame transmission and error handling.

Uploaded by

joseph.vayalattu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

COMPUTER NETWORKS

MODULE 2

Dr. TRIPTI C

DCS

RSET
Introduction to DLL Protocols
• A link level protocol that wants to deliver frames reliably must
recover the lost frames.

• Two fundamental mechanisms:


• Acknowledgements
• Time Outs
Acknowledgement
• An acknowledgement (ACK for short) is a small control frame that a
protocol sends back to its peer saying that it has received the earlier
frame.
• A control frame is a frame with header only (no data).
• The receipt of an acknowledgement indicates to the sender of the original
frame that its data frame was successfully delivered.
Timeout
• If the sender does not receive an acknowledgment after a reasonable
amount of time, then it retransmits the original frame.
• The action of waiting a reasonable amount of time is called a timeout.
• The general strategy of using acknowledgements and timeouts to
implement reliable delivery is called Automatic Repeat reQuest (ARQ).
Protocols in ARQ
• Stop and Wait Protocol
• Sliding Window Protocol
• Go Back N
• Selective Repeat
Stop and Wait Protocol
• Idea of stop-and-wait protocol is straightforward.

• After transmitting one frame, the sender waits for an acknowledgement


before transmitting the next frame.

• If the acknowledgement does not arrive after a certain period of time, the
sender times out and retransmits the original frame.
Stop and Wait Protocol
Timeline showing four different scenarios
for the stop-and-wait algorithm.
(a) The ACK is received before the timer
expires; (b) the original frame is lost;
(c) The ACK is lost; (d) the timeout fires
too soon
Stop and Wait Protocol
• If the acknowledgment is lost or delayed in arriving:
• The sender times out and retransmits the original frame, but the receiver will think that
it is the next frame since it has correctly received and acknowledged the first frame.
• As a result, duplicate copies of frames will be delivered.

• How to solve this??


• Use 1 bit sequence number (0 or 1).
• When the sender retransmits frame 0, the receiver can determine that it is seeing a
second copy of frame 0 rather than the first copy of frame 1 and therefore can ignore it
(the receiver still acknowledges it, in case the first acknowledgement was lost).
Stop and Wait Protocol
• Sender’s Window size ( Ws) = Receiver’s Window size ( Wr)= 1.
• Sequence number= [0,1]
Stop and Wait Protocol- Features
• The sending device keeps a copy of the sent frame transmitted until it receives an
acknowledgment (ACK).
• The sender starts a timer when it sends a frame. If an ACK is not received within an
allocated time period, the sender resends it.
• Both frames and acknowledgment (ACK) are numbered alternately 0 and 1( two
sequence number only).
• This numbering allows for identification of frames in case of duplicate transmission.
• The acknowledgment number defines the number of next expected frame. (frame 0
received ACK 1 is sent).
Stop and Wait Protocol- Features
• A damage or lost frame treated by the same manner by the receiver.
• If the receiver detects an error in the received frame or receives a frame out of order, it
simply discards the frame.
• The receiver send only positive ACK for frames received safe; it is silent about the
frames damage or lost.
• The sender has a control variable holds the number of most recently sent frame S(0 or
1). The receiver has control variable R, that holds the number of the next frame
expected (0 or 1).
Stop and Wait Protocol- Normal
operation
• The sender will not send the next frame
until it is sure that the current one is
received.
• Sequence number is necessary to check for
duplicated frames .
Stop and Wait Protocol- Lost or
Damaged frame
• A damage or lost frame treated by the
same manner by the receiver.

• No ACK when frame is corrupted or


duplicate.
Stop and Wait Protocol- Lost ACK

• Importance of frame numbering.


• Prevents retaining duplicate frames.
Stop and Wait Protocol- Delayed ACK
& Lost frame
• Importance of frame numbering.

• Numbered acknowledgments are


needed if an acknowledgment is
delayed, and the next frame is lost.
Piggybacking

• Method to combine a data frame with


an acknowledgment.
• Used in bidirectional cases.
• It can save bandwidth because data
frame and an ACK frame can be
combined into just one frame.
Stop and Wait- Disadvantage
• After each frame sent the host must wait for an ACK.
Inefficient use of bandwidth.

• To improve efficiency ACK should be sent after multiple frames only.


• Alternatives: Sliding Window protocol.
Sliding Window Protocols
• For sending multiple frames at a time, thus improves efficiency of the transmission.
• No. of frames to be sent at a time is based on window size.
• Outstanding frames: frames sent but not acknowledged.
• Can send up to W frames and keep a copy of outstanding frames until the ACKs arrive.
• Each frame is numbered sequence number.
• Sequence number is stored in the header of the frame.
• If the header has ‘m’ bits for sequence number, it ranges from 0 to 2m -1.
• If m = 3, sequence ranges from 0 to 7.
Sliding Window Protocols
• Sliding window is used to hold the unacknowledged outstanding frames.
• 2 bidirectional sliding window protocols with (max sending & receiving window
size) are:
• 1-bit sliding window (1,1)
• Go back N ARQ(>1,1)
• Selective Repeat ARQ(>1,>1)

• They differ in efficiency, complexity and buffer requirements.


27/07/2025

1-bit Sliding Window Protocol

• Window size=1.
• Uses stop and wait since the sender transmits a frame and waits for its
acknowledgement before sending the next one.
27/07/2025

Go back N Sliding Window Protocol

• Uses the concept of protocol pipelining: multiple frames can be transmitted


before receiving acknowledgement for the first frame.
• Finite number of frames and frames are numbered sequentially.
• The number of frames that can be send depends on sender window size.
• If acknowledgement of a frame is not received within the time interval, all
frames in the current window are retransmitted.
27/07/2025

Go back N Sliding Window Protocol

• Uses cumulative acknowledgement technique


• ‘N’  Sender’s window size ().
• ‘N’ is the number of frames that can be sent at a time before receiving
acknowledgement.
• Receiver’s window size is always 1 ().
27/07/2025

Go back N Sliding Window Protocol

• Size of the sending window determines the sequence numbers of the frames.
• E. g. if the sending window size=4, then the sequence numbers will be 0, 1, 2,
3, 0, 1, 2, 3 and so on.
• Let ‘m’ represents number of bits to represent sequence number, the range
of sequence numbers assigned are 0 to .
27/07/2025

Go back N Sliding Window Protocol


Go back N Sliding Window Protocol-
Features
• One timer for the first outstanding frame.
• The receiver sends a positive ACK if a frame has arrived safe and in order.
• If a frame is damaged or out of order ,the receiver is silent and will discard all
subsequent frames.
• When the timer of an unacknowledged frame at the sender site is expired , the
sender goes back and resend all frames , beginning with the one with expired timer.
Selective Repeat Sliding Window
Protocol
• Go back N protocol works well when errors are rare.
• Wastes a lot of bandwidth on retransmitted frames.
• Resent only the damaged frame while the correct frames are received and buffered.
• Receiver keeps track of the sequence numbers, buffers the frames in memory and
send NACK for only frames which is missing or damaged.
• Both sender and receiver maintain a window of outstanding and acceptable
sequence numbers, respectively.
Selective Repeat Sliding Window
Protocol
• Seq number =, where ‘m’ is the number of bits to represent sequence number.
• E. g. : Let m=2, seq num=[0,1,2,3]
• Sender’s Window size ( Ws) = Receiver’s Window size ( Wr)= .
• Window size should be less than or equal to half the sequence number in Selective
Repeat protocol ().
• Receiver must be able to accept packets out of order.
• Since receiver must release packets to higher layer in order, the receiver must be
able to buffer some packets.
Selective Repeat Sliding Window
Protocol
• When a frame arrives , its sequence number is checked to see if it falls within the
window.
• If so, and if it has not already been received, it is accepted and stored.
• No. of retransmissions < that in Go back N ARQ
• Sender will retransmit only the packets for which NACK is received.
• It is more efficient for noisy link, but the processing at the receiver is more
complex.
Selective Repeat Sliding Window
Protocol
27/07/2025

GO BACK N SELECTIVE REPEAT

• Receiver in case of error discards all subsequent • Receiver in case of error discards bad frame,
frames. buffers all good frames.
• Sends no ACK for discarded frames. • Sends a (NAK) when it detects an error.

• Receiver window size =1. • Receiver window size >1.

• Data link refuses to accept any frame except the • Buffers remaining frames received.
next one it must give to the network layer.
• Eventually sender will time out and retransmit • When sender times out, only the oldest
all unacknowledged frames in order starting unacknowledged frame is retransmitted as
with damaged or lost one. others are already buffered.
• Waste of bandwidth. • Better use of bandwidth.
27/07/2025

Go back
N

Selective
Repeat
Sliding Window Protocol
• Q1. Using 5 bit sequence numbers what is the maximum size of sender and receiver
window for the following protocols: a) stop and wait ARQ (b) go back n ARQ (c) selective
repeat ARQ
• (a)
• (b) The maximum sender window size in go-back n is (2^n)-1, n is the sequence number.
,
• (c) The maximum window size is (2^n)/2
Sliding Window Protocol
• Q2. A sender sends a series of packets to the same destination using 5-bit sequence
numbers. If the sequence number starts with 0, what is the sequence number after
sending 100 packets?
With 5 bits, no of sequence no. possible is 32 ie (0-31)
For frames 1-32 seq no 0-31
For frame 33-64 seq no 0-31
For frame 65-96 seq no 0-31
Now 97 98 99 100
0 1 2 3
So after sending 100 packets sequence no is 4
Sliding Window Protocol
• Q3. Station A needs to send a message consisting of 9 packets to station B using a
sliding window (window size=3) and go back N strategy. All packets are ready and
immediately available for transmission. If every 5th packet that A transmits gets lost
(but no ACKs from B ever get lost), then what is the number of packets that A
transmit to B?

• Ans: 16
Sliding Window Protocol
• Q4. Host A wants to send 10 frames to host B. The hosts agreed to go with Go back
4. How many frames are transmitted by Host A if every 6th frame that is transmitted
by host A is either corrupted or lost?

• Ans: 17
Sliding Window Protocol
• Q5. In SR protocol, suppose frames through 0 to 4 have been transmitted. Now
imagine that 0 times out, 5(a new frame) is transmitted, 1 times out, 2times out
and 6 (another new frame) is transmitted. At this point, what will be the
outstanding packets in sender’s window?

• Ans: 3 4 0 5 1 2 6
Sliding Window Protocol
• Q4. Host A wants to send 10 frames to host B. The hosts agreed to go with SR
protocol. How many frames are transmitted by Host A if every 6th frame that is
transmitted by host A is either corrupted or lost?

• Ans: 11
THANK YOU!!!

You might also like