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

DDL Sliding Window Protocols

Uploaded by

shaikmaseera1229
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)
11 views

DDL Sliding Window Protocols

Uploaded by

shaikmaseera1229
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/ 20

Sliding Window Protocols

• In the previous protocols, data frames were


transmitted in one direction only.
• In most practical situations, there is a need for
transmitting data in both directions.
• One way of achieving full-duplex data transmission is
to have two separate communication channels and use
each one for simplex data traffic (in different
directions).
• If this is done, we have two separate physical circuits,
each with a “forward” channel (for data) and a
“reverse” channel (for acknowledgements).
Sliding Window Protocols
• In both cases the bandwidth of the reverse channel
is almost entirely wasted.
• In effect, the user is paying for two circuits but
using only the capacity of one.
• Another way of achieving full-duplex data
transmission is to use the same circuit for data in
both directions.
Sliding Window Protocols
• Now we will discuss the model in which
the data frames from A to B are intermixed
with the achnowledgement frames from A
to B.
• By looking at the kind field in the header of
an incoming frame, the receiver can tell
whether the frame is data or
acknowledgement.
Sliding Window Protocols: Piggybacking

• Although interleaving data and control frames


on the same circuit is an improvement over
having two separate physical circuits, yet
another improvement is possible.
• When a data frame arrives, instead of
immediately sending a separate control frame,
the receiver restrains itself and waits until the
network layer passes it the next packet.
Sliding Window Protocols:
• The ACK Piggybacking
is attached to the outgoing data frame
(using the ACK field in the frame header). In effect,
ACK gets free ride on the next outgoing data frame.
• The technique of temporarily delaying outgoing ACK
so that they can be hooked onto the next outgoing data
frame is known as Piggybacking.
• An advantage of using piggybacking over having
distinct ACK frames is a better use of the available
channel bandwidth. The ACK field in the frame header
costs only a few bits, whereas a separate frame would
need a header, the ACK, and a checksum.
• In addition, fewer frames sent generally means a
lighter processing load at the receiver.
Sliding Window Protocols:
• Piggybacking
However, piggybacking introduces a complication not present
with separate ACKs.
• How long should the data link layer wait for a packet onto
which to piggyback the acknowledgement?
• If the data link layer waits longer than the sender’s timeout
period, the frame will be retransmitted, defeating the whole
purpose of having ACKs.
• Of course, the DLL cannot foretell the future, so it must resort to
some ad hoc scheme, such as waiting a fixed number of
milliseconds.
• If a new packet arrives quickly, the ACK is piggybacked onto it;
otherwise, if no packet has arrived by the end of this time period,
the data link layer just sends a separate ACK frame.
Sliding Window Protocols:
Piggybacking

Figure 1: Piggybacking
Sliding Window Protocols
• In all sliding window protocols, each outbound
frame contains a sequence number, ranging from
0 up to some maximum.
• The maximum is usually 2n-1 so the sequence
number fits exactly in an n-bit field.
• The stop-and-wait sliding window protocol uses
n=1, restricting the sequence number to 0 and
1.
Sliding Window Protocols
• The essence of all sliding window protocols is
that at any instant of time, the sender maintains a
set of sequence numbers corresponding to
frames it is permitted to send.
• These frames are said to fall within the
sending window.
• Similarly, the receiver also maintains a receiving
window corresponding to the set of frames it is
permitted to accept.
Sliding Window Protocols
• The sender’s window and the receiver’s
window need not have the same lower and
upper limits or even have the same size.
• In some protocols they are fixed in size, but
in others they can grow or shrink over the
course of time as frames are sent and
received.
Sliding Window Protocols

Figure 2: A sliding window of size 1, with a 3-bit sequence number.


(a). Initially. (b). After the first frame has been sent. (c). After the first
frame has been received. (d). After the first acknowledgement has been
received.
Sliding Window Protocols
• PROTOCOL 4: A One-Bit Sliding Window Protocol
• PROTOCOL 5: A Protocol Using Go Back N
• PROTOCOL 6: A Protocol Using Selective Repeat

• The above three protocols are bidirectional protocols that


belong to a class called sliding window protocols.
• The three differ among themselves in term of efficiency,
complexity, and buffer requirements.
PROTOCOL 4: A One-Bit Sliding Window Protocol
• A one-bit sliding window protocol uses a window size of 1 and also it uses
stop-and-wait since the sender transmits a frame and waits for its
acknowledgement before sending the next one.
• Under normal circumstances, the sending machine fetches the first packet
from its network layer, builds a frame from it, and sends it. When this (or any)
frame arrives, the receiving data link layer checks to see if it is a duplicate,
just as in protocol 3. If the frame is the one expected, it is passed to the
network layer and the receiver’s window is slid up.
• The acknowledgement field contains the number of the last frame received
without error. If this number agrees with the sequence number of the frame
the sender is trying to send, the sender knows it is done with the frame stored
in buffer and can fetch the next packet from its network layer. If the sequence
number disagrees, it must continue trying to send the same frame.
• Assume that the communication b/w computer A and computer B. When the
first valid frame arrives at computer B, it will be accepted and frame expected
will be set to a value of 1. All the subsequent frames received will be rejected
because B is now expecting frames with sequence number 1, not 0.
PROTOCOL 4: A One-Bit Sliding Window Protocol

Figure 3: Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case.
The notation is (seq, ack, packet number). An asterisk indicates where a
network layer accepts a packet.
PROTOCOL 5: A Protocol Using Go Back N
• Until now we have made the tacit assumption that the transmission time
required for a frame to arrive at the receiver plus the transmission time for
the acknowledgement to come back is negligible.
• Sometimes this assumption is clearly false. In these situations the long
round-trip time can have important implications for the efficiency of the
bandwidth utilization.
• The technique of keeping multiple frames in flight is called as pipelining.
• Pipelining frames over an unreliable communication channel raises some
serious issues. First, what happens if a frame in the middle of a long stream
is damaged or lost? Large numbers of succeeding frames will arrive at the
receiver before the sender even finds out that anything is wrong.
• When a damaged frame arrives at the receiver, it obviously should be
discarded, but what should the receiver do with all the correct frames
following it? Remember that the receiving data link layer is obligated to
hand packets to the network layer in sequence.
PROTOCOL 5: A Protocol Using Go Back N
Two basic approaches are available for dealing with errors in the
presence of pipelining.

• One approach, called go-back-n, is for the receiver simply to


discard all subsequent frames, sending no acknowledgements for
the discarded frames. This strategy corresponds to a receive
window of size 1 is shown in figure 4.

• In other words, the data link layer refuses to accept any frame
except the next one it must give to the network layer. Eventually,
the sender will time out and retransmit all unacknowledged
frames in order, starting with the damaged or lost one. This
approach can waste a lot of bandwidth if the error rate is high.
PROTOCOL 5: A Protocol Using Go Back N

Figure 4: Pipelining and error recovery. Effect on an error when Receiver’s


window size is 1.
PROTOCOL 6: A Protocol Using Selective Repeat
• The next approach for handling errors when frames are
pipelined is called selective repeat. When it is used, a
bad frame that is received is discarded, but any good
frames received after it are accepted and buffered.
• When the sender times out, only the oldest
unacknowledged frame is retransmitted. If that frame
arrives correctly, the receiver can deliver to the network
layer, in sequence, all the frames it has buffered.
• Selective repeat corresponds to a receiver window larger
than 1. This approach can require large amounts of data
link layer memory if the window is large.
PROTOCOL 6: A Protocol Using Selective Repeat
• Selective repeat is often combined with having the receiver send a negative
acknowledgement (NAK) when it detects an error, for example, when it
receives a checksum error or a frame out of sequence. NAKs stimulate
retransmission before the corresponding timer expires and thus improve
performance.
• In the below figure 5 shown, frames 0 and 1 are correctly received and
acknowledged and frame 2 is lost. When frame 3 arrives at the receiver, the
DLL there notices that it has missed a frame, so it sends back a NAK for 2
but buffers 3. When frames 4 and 5 arrive, they, too, are buffered by the
DLL instead of being passed to the network layer.
• Eventually, the NAK 2 gets back to the sender, which immediately resends
frame 2. When that arrives, the DLL now has 2, 3, 4, and 5 and can pass all
of them to the network layer in the correct order. It can also acknowledge
all frames up to and including 5, as shown in the figure. If the NAK should
get lost, eventually the sender will time out for frame 2 and send it (and
only it) of its own accord, but that may be a quite a while later.
PROTOCOL 6: A Protocol Using Selective Repeat

Figure 5: Pipelining and error recovery. Effect on an error when


receiver’s window size is large.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy