Chapter 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

DATA LINK PROTOCOLS NOISY CHANNELS

(Flow&Error control protocols)

control protocols)
3.2 DATA LINK PROTOCOLS NOISY CHANNELS
(Flow&Error control protocols)

❑ Stop-and-Wait Protocol gives us an idea of how to add flow control.


❑ Noiseless channels are nonexistent, hence error occur.
❑ We discuss three protocols in this section that use error control.
▪ Stop-and-Wait Automatic Repeat Request(ARQ) ***
▪ Go-Back-N Automatic Repeat Request (ARQ) ***
▪ Selective Repeat Automatic Repeat Request (ARQ) ***
❑ Automatic Repeat Request(ARQ)
Purpose: To ensure a sequence of information packets is delivered in order and without
errors or duplications despite transmission errors & losses
1.Stop-and-Wait ARQ (Automatic Repeat reQuest)
protocol***
❑ For noisy link, pure stop and wait protocol will break down, and solution is to incorporate some
error control mechanism

❑ Stop and wait with ARQ: Automatic Repeat reQuest (ARQ), an error control method,

is incorporated with stop and wait flow control protocol


⮚ In case a frame never got to receiver, sender has a timer: each time a frame is sent, timer is
set ! If no ACK is received during timeout period, it re-sends the frame
⮚ Timer introduces a problem: Suppose timeout and sender retransmits a frame but receiver
actually received the previous transmission ! receiver has duplicated copies.
⮚ To avoid receiving and accepting two copies of same frame, frames and ACKs are alternatively
labeled 0 or 1: ACK0 for frame 1, ACK1 for frame 0
1.Stop-and-Wait ARQ (Automatic Repeat reQuest)
protocol (cont…)
1. 2 Design ( Figure shows Design of the Stop-and-Wait ARQ Protocol )
1.Stop-and-Wait
1. Stop-and-Wait ARQ ARQ (Automatic
(Automatic Repeat
Repeat Request) reQuest)
protocol
(cont,d…)
protocol(cont..)
Algorithm :Sender-site algorithm for Stop-and-Wait ARQ
1. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont,d…)

Algorithm :Sender-site algorithm for Stop-and-Wait ARQ (continued)


1.Stop-and-Wait
1. Stop-and-Wait ARQ ARQ (Automatic
(Automatic Repeat
Repeat Request) reQuest)
protocol
protocol(cont…)
(cont,d…)

Algorithm : Receiver-site algorithm for Stop-and-Wait ARQ


Protocol
1.Stop-and-Wait ARQ (Automatic Repeat reQuest)
protocol(cont…)
1. Stop-and-Wait ARQ (Automatic Repeat Request) protocol (cont,d…)

Example 1.
⮚ Figure 1 shows an example of Stop-and-Wait ARQ.

Event :
1. Frame 0 is sent and acknowledged.
2. Frame 1 is lost and resent after the time-out.
3. The resent frame 1 is acknowledged and the timer stops.
4. Frame 0 is sent and acknowledged, but the acknowledgment is lost.
5. The sender has no idea if the frame or the acknowledgment is lost.
6. so after the time-out, it resends frame0, which is acknowledged.
1.Stop-and-Wait ARQ (Automatic Repeat reQuest)
protocol(cont…)
1. Stop-and-Wait
ARQ
(Automatic
Repeat Request)
protocol
(cont,d…)

Figure : Flow
diagram for
Example 1
1.Stop-and-Wait ARQ (Automatic Repeat reQuest)
1.3 Efficiency of Stop-and-Wait ARQ (cont’d…)
protocol(cont…)
❑ Advantages of stop and wait ARQ
1. It can be used for noisy channels
2. It has both error and flow control mechanism
3. It has timer implementation
❑ Disadvantages of stop and wait ARQ
1. Efficiency is very less.
2. Only 1 frame is sent at a time
3. Timer should be set for each individual frame
4. No pipelining
5. sender window size is 1( disadvantage over Go back N ARQ)
6. receiver window size is 1( disadvantage over selective repeat ARQ)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)***

⮚ Improve Stop-and-Wait by not waiting.


⮚ To improve the efficiency of transmission multiple frames must be in transition while
waiting for acknowledgment.
⮚ Keep channel busy by continuing to send frames.
⮚ Several frames are send before receiving acknowledgments.
⮚ keep a copy of these frames until the acknowledgments arrive.
⮚ Use m-bit sequence numbering.
⮚ Sequence numbers are modulo 2m,where m is the size of the sequence number field in bits.
⮚ For example, if m is 4, the only sequence numbers are 0 through 15 inclusive.
However, we can repeat the sequence. So the sequence numbers are
0, 1,2,3,4,5,6, 7,8,9, 10, 11, 12, 13, 14, 15,0, 1,2,3,4,5,6,7,8,9,10, 11, …
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
(cont..)
❑ Concept
▪ Introduce a window of size n
▪ Can inject n packets into net before hearing an ACK
❑ Sliding window
▪ Sliding window is an abstract concept that defines the range of sequence
numbers that is the concern of the sender and receiver.
▪ The sender and receiver need to deal with only part of the possible sequence
numbers.
▪ Label each packet with a sequence number
▪ A window is a collection of adjacent sequence numbers
▪ The range which is the concern of the sender is called the send sliding window
▪ The range that is the concern of the receiver is called the receive sliding window.
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
(cont..)
Figure 3: Send window for Go-Back-N ARQ
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
(cont..)

❑ The send window is an imaginary box covering the sequence numbers of the data frames
which can be in transit.
❑ The window at any time divides the possible sequence numbers into four regions.
▪ First Region: It defines the sequence numbers belonging to frames that are already
acknowledged
▪ Second Region: It defines the range of sequence numbers belonging to the frames that
are sent and have an unknown status. call these “outstanding frames.”
▪ Third Region: It defines the range of sequence numbers for frames that can be sent; but
not yet been received from the network layer.
▪ Fourth Region: It defines sequence numbers that cannot be used until the window
slides
❑ The send window is an abstract concept defining an imaginary box of size 2m − 1 with
three variables: Sf, Sn, and Ssize.
3.23.2Go-Back-N Automatic Repeat reQuest (ARQ)
Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
❑ The send window can slide one or more slots when a valid acknowledgment arrives

Figure 4 : Receive window for Go-Back-N ARQ

❑ The receive window is an abstract concept defining an imaginary box of size 1 with one
single variable Rn. The window slides when a correct frame has arrived; sliding occurs
one slot at a time
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
(cont..)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
⮚ Timers
▪ Although there can be a timer for each frame that is sent, in this protocol use only one.
▪ The reason is that the timer for the first outstanding frame always expires first; send
all outstanding frames when this timer expires.

⮚ Acknowledgment
▪ The receiver sends a positive acknowledgment if a frame has arrived safe and sound
and in order.
▪ If a frame is damaged or is received out of order, the receiver is silent and will discard
all subsequent frames until it receives the one it is expecting.
▪ The silence of the receiver causes the timer of the unacknowledged frame at the
sender site to expire.
▪ This, in turn, causes the sender to go back and resend all frames, beginning with the
one
with the expired timer.
▪ The receiver does not have to acknowledge each frame received. It can send one
cumulative acknowledgment for several frames.
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
(cont..)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)

⮚ Resending a Frame
▪ When the timer expires, the sender resends all outstanding frames. For example,
suppose
the sender has already sent frame 6, but the timer for frame 3 expires.
▪ This means that frame 3 has not been acknowledged; the sender goes back and
sends frames 3, 4,5, and 6 again. That is why the protocol is called Go-Back-N
ARQ.
3.2 3.2
Go-Back-N Automatic Repeat reQuest (ARQ)
Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
Figure 5 : Design of Go-Back-N ARQ
❑ Send Window Size
▪ In Go-Back-N ARQ, the size of the send window must be less than 2m ; the size of the receiver window is
always 1.
o Figure 6 Window size for Go-Back-N ARQ
3.2 3.2
Go-Back-N Automatic Repeat reQuest (ARQ)
Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
❑ Algorithms ( Algorithm.7 Go-Back-N sender algorithm)

(continued)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
❑ Algorithms ( Algorithm.7 Go-Back-N sender algorithm)
(continued)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ)
3.2 Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
❑ Algorithms : Go-Back-N receiver algorithm
3.23.2Go-Back-N Automatic
Go-Back-N Automatic Repeat
Repeat reQuest (ARQ) reQuest (ARQ)
(cont’d….)
(cont..)
❑ Example 1
▪ Figure 1 shows an example of Go-Back-N.
▪ This is an example of a case where the forward channel is reliable, but the reverse is not.
▪ No data frames are lost, but some ACKs are delayed and one is lost.
▪ The example also shows how cumulative acknowledgments can help if
acknowledgments are delayed or lost.
▪ After initialization, there are seven sender events. Request events are triggered by data
from the network layer; arrival events are triggered by acknowledgments from the
physical layer.
▪ There is no time-out event here because all outstanding frames are acknowledged before
the timer expires.
▪ Note that although ACK 2 is lost, ACK 3 serves as both ACK 2 and ACK 3.
3.2 3.2
Go-Back-N Automatic Repeat reQuest (ARQ)
Go-Back-N Automatic Repeat reQuest (ARQ) (cont’d….)
(cont..)
❑ Example 1 ( Figure 1 Flow diagram for Example 1)
Selective Repeat Automatic Repeat Request


Go-Back-N ARQ simplifies the process at receiver site.

Receiver keeps track of only one variable

Out of order frames are discarded

But this method is inefficient for noisy channel.

Noisy channel frame has higher probability of damage ,resending frames uses bandwidth and

slows down the transmission



Channel like this needs mechanism that only resends the damaged frame

The mechanism is called Selective Repeat ARQ
Selective Repeat Automatic Repeat Request

Windows

Two windows used

A send window

A receive window


Send window and receive window both are of same size (2m-1)
Selective Repeat Automatic Repeat Request


Protocol allows as many frames as the size of the sender window

Frames arrive out of order and be kept until there is a set of in-order frames to be delivered to the

network layer

All frame in the send frame can arrive out of order and be stored until they can be delivered

If size of window is 2 and all acknowlegments are lost ,the time for frame 0 expires and frame 0 is

resent

However ,the window of the receiver is now expecting frame 2 ,not frame 0,so this duplicate frame is

correctly discarded.

When the size of the window is 3 and all acknowledgements lost ,the sender sends a duplicate of

frame 0

However this time the window of receiver expects to receive frame 0(0 is part of the window ),so it

accepts frame 0,not as a duplicate ,but as the first frame in the next cycle.

You might also like