Title: Module 15 Sliding Windows Protocol, and Error Control
1Module 15Sliding Windows Protocol, and Error
Control
2- Textbook sections
- LG Section 5.2 ARQ Protocols
- Topics
- Sliding Window
- Overview
- Terminology
- The sliding of sliding window
- Considerations
- Error Control
- Stop-and-wait ARQ
- Go-back-N ARQ
- Selective Repeat ARQ
31.0 Sliding Windows - Overview
- Sliding window protocol (SWP)
- A protocol that allows several data units to be
in transition before receiving an
acknowledgement. SWP is used in TCP for error
control and flow Control - Send window
- Maintain by the sender
- A set of sequence number
- Represents a range of permissible sequence
numbers for transmitted but not-yet-acknowledged
frames - As the protocol operates, the window slides
forward over the sequence number space. - Receive window
- Maintain by the receiver
- A set of sequence number
- Represents a range of frames it is permitted to
accept - As the protocol operates, the window slides
forward over the sequence number space. - Microsoft Windows NT use 8760 as the default
window size
41.0 Sliding Windows - Overview
- Typical scenario
- TCP sender accepts a data stream from the upper
layers, breaks large streams of data into smaller
segments, sequence each segment, and places this
stream in a send window - TCP sender adds this information in the transport
layers header, and then hands it down to IP to be
formed into packets - When TCP transmits each segment to IP, the TCP
protocol sets a retransmission timer, specifying
how long itll wait for an acknowledgement (an
ACK) before the segment is retransmitted. A copy
of each segment remains inside the send window
until an acknowledgement is received
51.0 Sliding Windows - Overview
- Typical scenario (continue)
- The sequence number that TCP adds to each
segment are used to put the segments back
together at the receiver. - An acknowledge for each segment is sent back to
the sender. - When the acknowledge is returned from the
receiver and received by the sender, the send
window slides (hence the name sliding windows)
pass the acknowledged data to the remaining data
stream waiting to be sent. - If the sender does not receive an acknowledgment
with the time originally set, the segment will be
resent. - Retransmitting segments takes up precious
bandwidth on the network.
61.0 Sliding Windows - Overview
- Highlights
- Each byte of data is assigned a sequence number
- The sequence number of the first byte of data in
a segment is transmitted with that segment and is
called the segment sequence number - Segment also carry an acknowledgement number
which is the sequence number of the next expected
data byte of transmission in the reverse
direction. - When the TCP transmits a segment containing data,
it puts a copy on a retransmission queue and
starts a timer. - When the acknowledgement for that data is
received, the segment is deleted from the queue. - If the acknowledgement is not received before the
timer runs out, the segment is retransmitted. - The TCP receiver reports a window to the TCP
sender. This window specifies the number of
bytes, starting with the acknowledge number, that
the TCP receiver is currently prepared to
receive. (Note This is the value in the window
size field from the receiver)
71.0 Sliding Windows - Terminology
- Send Sequence Space
-
- 1 2 3 4
- -----------------------------------------------
--------------- - SND.UNA SND.NXT
SND.UNA SND.WND - SND.UNA Send unacknowledged
- SND.NXT Send nest
- SND.WND Send window size
- 1 old sequence numbers which have been
acknowledged - 2 sequence numbers of unacknowledged data
- 3 sequence numbers allowed for new data
transmission - 4 future sequence numbers which are not yet
allowed - The send window is the portion of the sequence
space labeled 3.
81.0 Sliding Windows - Terminology
- Receive Sequence Space
-
- 1 2 3
- ----------------------------------------------
- RCV.NXT RCV.NXT
RCV.WND - RCV.NXT receive next
- RCV.WND receive window size
- 1 old sequence numbers which have been
acknowledged - 2 sequence numbers allowed for new reception
- 3 future sequence numbers which are not yet
allowed - The receive window is the portion of the sequence
space labeled 2.
91.0 Sliding Windows - The sliding of sliding
window
Sliding Window
101.0 Sliding Windows - The sliding of sliding
window
Sender Sliding Window
- Note
- ACK controls the right boundary of the send
window - Sending frames controls the left boundary of the
send window
111.0 Sliding Windows - The sliding of sliding
window
Receiver Sliding Window
- Note
- ACK controls the right boundary of the receive
window - Receiving frames controls the left boundary of
the receive window
12Sliding Window Example
131.0 Sliding Windows - Considerations
- Considerations
- Sliding Window Protocol (SWP) mechanisms
- Acknowledgement (ACK) A response sent by the
receiver to indicate the successful receipt and
acceptance of data. - Negative acknowledgement (NAK) A message sent to
indicate the rejection of received data. - Retransmission timer
- Sender application programs, receiver application
programs, sequence number, acknowledgement
number, window size. - The relationship between sequence number space
and maximum window size
142. Error Control
152. Error Control
- Purpose
- A technique used to ensure that a data stream is
delivered accurately to the user despite errors
that occur during transmission - Automatic Repeat Request (ARQ) forms the basis
for peer-to-peer protocols - For both hop-by-hop and end-to-end approaches
- Information flow can be in one direction or both
directions - Assumptions
- Frames arrive at the receiver in the same order
in which they are sent - Types
- Stop-and-wait ARQ
- Go-back-N ARQ
- Selective Repeat ARQ
162. Error Control
- For each type of ARQ, four scenarios are
considered - Normal scenario
- Abnormal scenarios
- Damaged frame
- Lost frame
- Lost ACK
172. Error Control
LG Figure 5.8 Basic elements of ARQ
Error-free packet sequence
Information frames
Packet sequence
Transmitter
Receiver
Station B
Station A
Control frames
CRC
CRC
Header
Control frame
Information packet
Information Frame
182. Error Control Stop-and-Wait ARQ
- Stop-and-Wait ARQ
- Sender uses ACK, retransmission timer, and
sequence number - Scenario 1 (normal and Frame 1 lost)
192. Error Control Stop-and-Wait ARQ
LG Figure 5.9 Possible ambiguities when frames
are unnumbered
(a) Frame 1 lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK
ACK
B
(b) ACK lost
Time-out
time
A
frame 0
frame 1
frame 1
frame 2
ACK
ACK
ACK
B
- In parts (a) and (b) transmitting station A acts
the same way, but part (b) receiving station B
accepts frame 1 twice.
202. Error Control Stop-and-Wait ARQ
- Scenario 2 (ambiguity due to ACK not received)
- Figure 5.9 (b)
- Problem Loss of an ACK can result in the
delivery of duplicated packet to station B - Solution Include a sequence number in the header
of each frame - Scenario 3 (ambiguity due to premature time-out
and loss of frame) - Figure 5.10
- Problem Premature time-outs combined with loss
of I-frame can result in gaps in the delivered
packet sequence - Solution Provide a sequence number in the
acknowledgement frame that enables the
transmitter to determine which frames have been
received.
212. Error Control Stop-and-Wait ARQ
Figure 5.10 Possible ambiguities when ACKs are
unnumbered
time-out
time
A
frame 0
frame 0
frame 2
frame 1
ACK
ACK
B
- Transmitting station A misinterprets duplicate
ACKs
22Figure 5.11 System state information in
Stop-and-wait ARQ
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
Rnext
Slast
Timer
Slast
Receiver
Transmitter
Rnext
Station B
Station A
Error-free frame 0 arrives at receiver
(0,0)
(0,1)
Global State (Slast, Rnext)
ACK for frame 0 arrives at transmitter
ACK for frame 1 arrives at transmitter
Error-free frame 1 arrives at receiver
(1,0)
(1,1)
232. Error Control Stop-and-Wait ARQ
- Delay-bandwidth product
- The product of the bit rate and the delay that
elapses before an action can take place - A key performance parameter
- In stop-and-wait the delay-bandwidth product can
be viewed as a measure of lost opportunity in
terms of transmitted bits.
242. Error Control Stop-and-Wait ARQ
Stop and Wait
EOT End of Transmission
252. Error Control Stop-and-Wait ARQ
Damaged Frame sequence space consists of 0 and 1
0
1
0
Error in Frame 0
0
0
261.0 Sliding Windows
Lost Frame
0
0
0
0
271.0 Sliding Windows
Lost ACK
0
second
0
282. Error Control Go-Back-N(GBN) ARQ
- Go-Back-N(GBN) ARQ
- Pipeline
- A procedure where the processing of a new task is
begun before the completion of the previous task - In the context of ARQ, the sender will have to
buffer packets that have been transmitted, but
not yet acknowledged. Buffering of received
packets may also be needed at the receiver. - Description
- In a GBN protocol, the sender is allowed to
transmit multiple packets (when available)
without waiting for an acknowledgement, but is
constrained to have no more than some maximum
allowable number, N, of unacknowledged packets in
the pipeline.
292. Error Control Go-Back-N(GBN) ARQ
- Examples
- Example 1
- Figure 5.13 Basic Go-Back-N ARQ
- Typical case when N WS 4
- Example 2
- Figure 5.15 Go-Back-N ARQ
- Use timer
- Example 3
- Figure 5.16 The window size should be less than
2m - The receiver can determine the correct frame if
the window size is smaller than 2m where m is
the number of bits in the header which are
allotted to the sequence number representation
302. Error Control Go-Back-N(GBN) ARQ
- Example 4
- Figure 5.17 NAK error recovery
- The NAK procedure results in having the
transmitter go back less than WS frames - Example 5
- Figure 5.18 System parameter in bidirectional
Go-Back-N ARQ - Piggybacking The inclusion of acknowledgement on
a data frame. When a data frame arrives, instead
of immediately sending a separate control frame,
the receiver restrains itself and wait until the
network layer passes it the next packet. The
acknowledgement is attached to the outgoing data
frame (using the ACK field in the frame header).
In effect, the acknowledgement gets a free ride
on the next outgoing data gram.
312. Error Control Go-Back-N(GBN) ARQ
LG Figure 5.13 Basic Go-Back-N ARQ
4 frames are outstanding so go back 4
Go-Back-4
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 3
fr 5
fr 4
fr 6
fr 6
fr 7
fr 8
fr 9
A
B
Out-of-sequence frames
ACK1
ACK2
ACK4
ACK5
ACK3
ACK7
ACK6
ACK9
ACK8
error
322. Error Control Go-Back-N(GBN) ARQ
LG Figure 5.15 Go-Back-N ARQ
Transmitter
Receiver
Send Window
Receive Window
...
Frames transmitted and ACKed
Slast
Srecent
SlastWs-1
frames received
Buffers
Rnext
Slast
Timer
Slast1
The receiver will only accept a frame that is
error-free and that has sequence number Rnext
Timer
...
Srecent
Timer
...
SlastWs-1
33LG Figure 5.16 The window size should be less
then 2m
Transmitter goes back 4
M 22 4, Go-Back - 4
time
fr 0
fr 2
fr 1
fr 1
fr 3
fr 3
fr 2
fr 0
A
B
ACK2
ACK3
ACK4
ACK1
Receiver has Rnext0, but it does not know
whether its ACK for frame 0 was received, so it
does not know whether this is the old frame 0 or
a new frame 0
M224, Go-Back-3
Transmitter goes back 3
time
fr 0
fr 2
fr 1
fr 2
fr 0
fr 1
A
B
ACK2
ACK3
ACK1
Receiver has Rnext3 , so it rejects the old
frame 0
342. Error Control Go-Back-N(GBN) ARQ
LG Figure 5.17 NAK error recovery
Transmitter goes back to frame 1
Go-Back-7
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 1
fr 2
fr 4
fr 3
fr 5
fr 6
fr 7
fr 0
A
B
ACK2
ACK6
ACK1
ACK3
ACK4
ACK5
ACK7
Out-of-sequence frames
NAK1
error
35LG Figure 5.18 System parameters in bidirectional
Go-Back-N ARQ
Station B
Station A
SArecent RA next
Receiver
Transmitter
Transmitter
Receiver
SBrecent RB next
ACKs are piggybacked in headers
A Send Window
B Send Window
...
...
SA last
SB last
SA lastWA s-1
SB lastWB s-1
Buffers
Buffers
SA last
SB last
Timer
Timer
SA last1
SBlast1
Timer
Timer
...
...
SArecent
Timer
SBrecent
Timer
...
...
SA lastWA s-1
SB lastWB s-1
Timer
Timer
362. Error Control Go-Back-N(GBN) ARQ
Damaged Data Frame
372. Error Control Go-Back-N(GBN) ARQ
Lost Data Frame
382. Error Control Go-Back-N(GBN) ARQ
Lost ACK
392. Error Control Selective Repeat ARQ
- Selective Repeat ARQ
- Two new features
- The receiver windows is made larger than one
frame so that the receiver can accept frames that
are out of order but error free - The retransmission mechanism is modified so that
only individual frames are retransmitted - Algorithm
402. Error Control Selective Repeat
ARQTransmitters events and actions
41Receivers Events and Actions
2. Error Control Selective Repeat ARQ
422. Error Control Selective Repeat ARQ
- Selective Repeat ARQ
- Retransmission mechanism
- Timer When the timer expires, only the
corresponding frame is retransmitted. - NAK Whenever an out-of-sequence frame is
observed at the receiver, a NAK frame is sent
with sequence number Rnext. When the
transmission receives such a NAK frame, it
retransmits the specific frame, Rnext. - Figure 5.21 Error recovery in Selective Repeat
ARQ - Maximum send window size
- WS WR 2m-1 (2m)/2 half the sequence
number space - Example Figure 5.22 Maximum window size in
Selective Repeat ARQ
43LG Figure 5.20 Selective Repeat ARQ
Transmitter
Receiver
Send Window
...
Frames transmitted and ACKed
Slast
Srecent
SlastWs-1
Buffers
Buffers
Rnext1
Rnext2
...
RnextWr-1
442. Error Control Selective Repeat ARQ
LG Figure 5.21 Error recovery in Selective Repeat
ARQ
time
fr 0
fr 1
fr 2
fr 3
fr 4
fr 5
fr 2
fr 8
fr 7
fr 6
fr 9
fr 10
fr 11
fr 12
A
B
ACK2
NAK2
ACK7
ACK8
ACK9
ACK10
ACK11
ACK12
ACK2
ACK2
ACK1
ACK2
error
451.0 Sliding Windows
Selective Reject
46LG Figure 5.22 Maximum window size in Selective
Repeat ARQ
M224, Selective Repeat Send Window Receive
Window 3
Frame 0 resent
time
fr 0
fr 2
fr 1
fr 0
A
B
ACK2
ACK3
ACK1
3,0,1
Receive Window
Send Window Receive Window 2
Frame 0 resent
time
fr 0
fr 1
fr 0
A
B
ACK2
ACK1
frame 0 rejected
Receive Window
2,3