This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Wait for a packet / frame / timer eventStart a countdown timer runningStop a countdown timer from runningStart the ACK countdown timerStop the ACK countdown timer
Larger windows enable pipelining for efficient link use• Stop-and-wait (w=1) is inefficient for long links• Best window (w) depends on bandwidth-delay (BD)• Want w ≥ 2BD+1 to ensure high link utilization
Pipelining leads to different choices for errors/buffering• We will consider Go-Back-N and Selective Repeat
Computer Networks 1
10TUNALI
Sliding Window ProtocolsPrevious protocols involved transmission of data frames in only one direction
In practice, two way data communication is necessary
One way to achieve this is to have two lines each having forward and backward channels each implementing Protocol 2• This will waste bandwidth
Better way is to use the same circuit for data in both directions• There will be data and ack frames in each direction
Computer Networks 1
11TUNALI
PiggybackingThe performance is further improved by attaching ack to an outgoing data frame instead of sending a separate ack frame. (piggybacking)• Unnecessary overhead of sending a separate frame for
ack is avoided
Question: How long should data link layer wait for a packet onto which to piggyback the ack?
Answer: It starts an ack timer. If a data frame is received from the network layer in the mean time, ack is piggybacked,. if not, a separate ack frame is sent
Computer Networks 1
12TUNALI
Sliding Window Parameters
Sequence numbers of frames range from 0 to 2n–1 where n will be specified later for each protocol
Sending Window• A set of sequence numbers of frames the sender
is permitted to send
Receiving Window• A set of sequence numbers of frames the
receiver is permitted to accept
Computer Networks 1
13TUNALI
Sliding Window AssumptionsThe protocol must deliver packets to the destination network layer in the same order that they were passed to the data link layer on the sending machine
Physical communication channel must deliver all frames in the order sent
The senders window contains frames sent but not ack’ed yet
When a packet from network layer is received, the upper edge of the window is advanced
When ack is received, lower edge of the window is advanced
Computer Networks 1
14TUNALI
Receiver Window
Any frame falling outside the window is discarded
When a frame whose sequence number is equal to the lower edge of the window is received, • it is passed to the network layer• An ack is generated• Window is rotated by one
The receiver window always remains at its initial size
Computer Networks 1
15TUNALI
A One Bit Sliding Window Protocol
Sender and receiver window size is 1
Frame sequence numbers are 0 and 1
The ack field contains the number of the last frame received without error
No combination of lost frames or premature timeouts can cause the protocol to deliver duplicate packets to either network layer, or to skip a packet, or o get into a deadlock.
Transfers data in both directions with stop-and-wait• Piggybacks acks on reverse data frames for efficiency• Handles transmission errors, flow control, early timers
Receiver only accepts/acks frames that arrive in order:• Discards frames that follow a missing/errored frame• Sender times out and resends all outstanding frames
For correctness, we require:• Sequence numbers (s) at least twice the window (w)
Originals OriginalsRetransmits Retransmits
Error case (s=8, w=7) – too few sequence numbers
Correct (s=8, w=4) – enough sequence numbers
New receive window overlaps old – retransmits ambiguous
New and old receive window don’t overlap – no ambiguity
Computer Networks 1
24TUNALI
Receiver Window
Any frame falling outside the window is discarded
When a frame whose sequence number is equal to the lower edge of the window is received, • it is passed to the network layer• An ack is generated• Window is rotated by one
The receiver window always remains at its initial size
Computer Networks 1
25TUNALI
A One Bit Sliding Window Protocol
Sender and receiver window size is 1
Frame sequence numbers are 0 and 1
The ack field contains the number of the last frame received without error
No combination of lost frames or premature timeouts can cause the protocol to deliver duplicate packets to either network layer, or to skip a packet, or o get into a deadlock.
Computer Networks 1
26TUNALI
A One-Bit Sliding Window Protocol
Continued
Computer Networks 1
27TUNALI
A One-Bit Sliding Window Protocol (ctd.)
Computer Networks 1
28TUNALI
Peculiar Scenarios for Protocol 4
If both sides simultaneously send an initial packet, half of the frames contain duplicates but there is no transmission error
Same situation may happen with premature timeouts
Computer Networks 1
29TUNALI
A Protocol Using Go Back n
In protocol 4, sender is required to wait for an ack before the next frame is transmitted
If the propagation delay is high, this causes waist of bandwidth.
The solution is to allow the sender to transmit more than one frame before receiving any ack.
To maximize throughput, the sender is expected to send w frames to keep the line busy, called pipelining.
Computer Networks 1
30TUNALI
ExampleIf
Channel capacity: 50 kbps
Round trip propagation delay: 500 msec
Frame length: 1000 bit
Then
Frame transmission time is 20 msec
t=0 frame sent, t=520 msec ack received
Protocol 4 uses 20/520 of the bandwidth
To fully utilize bandwidth, w=520/20=26
Computer Networks 1
31TUNALI
Pipelining Receiver PoliciesQuestion• What happens to the frames received after receiving an
in correct frame?
Answer• Either discard all the frames proceeding the garbled
one, (called go back n, receiver window size 1)• Or accept those frames, but not forward the to the
network layer until the garbled one is retransmitted correctly (called selective repeat, receiver window size greater than 1)
Computer Networks 1
32TUNALI
Receiver Policies
Computer Networks 1
33TUNALI
Sliding Window Protocol Using Go Back
N
Continued
Computer Networks 1
34TUNALI
Sliding Window Protocol Using Go Back N
Continued
Computer Networks 1
35TUNALI
Sliding Window Protocol Using Go Back N
Continued
Computer Networks 1
36TUNALI
Sliding Window Protocol Using Go Back N
Computer Networks 1
37TUNALI
Protocol 5 Assumptions 1Network layer may not always have a packet to send• When it has a packet to send it causes
network_layer_ready event
Data link layer may not send frames as fast as the network layer wants• enable_network_layer
− Allow network layer to pass packets to data link layer
• disable_network_layer− Disallow network layer from passing packets to data link layer
Computer Networks 1
38TUNALI
Protocol 5 Assumptions 2
Sequence numbers range from 0 to MAX_SEQ
When an acknowledgement comes in for frame n, frames n-1, n-2, and so on are also automatically acknowledged
The window size is MAX_SEQ
Computer Networks 1
39TUNALI
Protocol 5 Assumptions 3There are at most MAX_SEQ many frames outstanding at any instant• If it were MAX_SEQ+1, then the protocol fails with the
following scenario− The sender sends frames 0 to MAX_SEQ− It receives ack for MAX_SEQ− The sender sends another batch of frames from 0 to MAX_SEQ− All of the last batch is lost− The receiver sends ack for the last correctly received frame
which is MAX_SEQ− The sender will think that all the frames of the last batch are
correctly received and the protocol will fail
Computer Networks 1
40TUNALI
Multiple timer management
Computer Networks 1
41TUNALI
A Protocol Using Selective Repeat Protocol 5 has poor performance if the error rate of the channel is high
An alternative receiver strategy is to accept frames proceeding a garbled one
Frame sequence numbers start from 0 and grow to some predefined maximum MAX_SEQ
The receiver window is always fixed and has a buffer reserved for each frame number in its window
Computer Networks 1
42TUNALI
A Sliding Window Protocol Using Selective Repeat
Continued
Computer Networks 1
43TUNALIContinued
A Sliding Window Protocol Using Selective Repeat (2)
Computer Networks 1
44TUNALI
A Sliding Window Protocol Using Selective Repeat (3)
Continued
Computer Networks 1
45TUNALI
A Sliding Window Protocol Using Selective Repeat (4)
Computer Networks 1
46TUNALI
Protocol 6 Mechanisms 1
Function between• Checks if the arriving frame sequence number
falls within the window
The window size is (MAX_SEQ+1)/2
Computer Networks 1
47TUNALI
Protocol 6 Mechanisms 2
The following scenario shows that the protocol fails when window size is MAX_SEQ• The sender transmits frames 0 to MAX_SEQ-1• At the receiver, all frames are received correctly• The receiver sends MAX_SEQ acks to sender
and slides the window to MAX_SEQ-MAX_SEQ-2
• All the acks are lost • Sender times out and retransmits all the
MAX_SEQ frames• The receiver accepts frames 0 to MAX_SEQ-2
as new frames and the protocol fails
Computer Networks 1
48TUNALI
Failure Scenario
Computer Networks 1
49TUNALI
Protocol 6 Mechanisms 3
The number buffers needed is the size of the window
There is a timer associated with each buffer
Protocol 5 assumes that there is always reverse traffic to piggyback acks and it blocks if there is no reverse traffic
Protocol 6 implements start_ack_timer • When a data frame arrives, a timer is started• If no data frame to send back, timer runs off and
a special ack frame is sent
Computer Networks 1
50TUNALI
Protocol 6 Mechanisms 4
If the receiver suspects that a frame is garbled or lost, it sends a NAK frame to the sender requesting retransmission
To prevent duplicate NAKs, variable no_nak is used.
If the standard deviation of ack interval is small, NAK is not that useful
PPP (Point-to-Point Protocol) is a general method for delivering packets across links• Framing uses a flag (0x7E) and byte stuffing• “Unnumbered mode” (connectionless unacknow-
ledged service) is used to carry IP packets• Errors are detected with a checksum