arq protocol part 2

35
Flow control in the transport layer Flow control in the transport layer refers to a set of procedures used to refers to a set of procedures used to restrict the amount of data that the restrict the amount of data that the sender can send before waiting for sender can send before waiting for acknowledgment. acknowledgment. Error control in the data link layer is Error control in the data link layer is based on automatic repeat request, based on automatic repeat request, which is the retransmission of data. which is the retransmission of data. Flow Control & Error Control Flow Control & Error Control

Upload: aanandha-saravanan

Post on 05-Jul-2015

141 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Arq protocol part 2

Flow control in the transport layer Flow control in the transport layer refers to a set of procedures used to refers to a set of procedures used to restrict the amount of data that the restrict the amount of data that the sender can send before waiting for sender can send before waiting for

acknowledgment.acknowledgment.

Error control in the data link layer is Error control in the data link layer is based on automatic repeat request, based on automatic repeat request,

which is the retransmission of data. which is the retransmission of data.

Flow Control & Error ControlFlow Control & Error Control

Page 2: Arq protocol part 2

Automatic Repeat reQuest (ARQ) ProtocolsAutomatic Repeat reQuest (ARQ) Protocols

Purpose: to ensure a sequence of information packets is delivered in order and without errors or duplications despite transmission errors & losses

We will look at: Stop-and-Wait ARQ Go-Back N ARQ Selective Repeat ARQ

Page 3: Arq protocol part 2

Stop-and-Wait ARQStop-and-Wait ARQ

Stop after Transmitting a FrameWait for an Acknowledgement

Transmitter Receiver

Packet

H

CRCH

Error Free Packet

ACK

Information Frame CRC

Transmitter Receiver

Packet

H

CRCH

Error Free Packet

ACK

Information Frame CRC

H : HeaderCRC : Cyclic Redundancy Check

(Error Detection)

Page 4: Arq protocol part 2

Importance of Sequence NumbersImportance of Sequence Numbers

In Scenario B, the receiver accepts Frame 1 Twice How could the Receiver Know whether or Not it has Received Frame 1

Correctly? BY INCLUDING THE FRAME SEQUENCE NUMBER IN THE

HEADER

Sender Receiver

ACK

Timeout

Frame 0

Frame 1

Frame 1

ACK

Frame 2

Sender Receiver

ACK

Timeout

Frame 0

Frame 1

Frame 1

ACK

Frame 2

ACK

A B

Page 5: Arq protocol part 2

Sequence Numbers in ACK FramesSequence Numbers in ACK Frames

The sender may mistakenly interpret ACK as it assumes that the second ACK was for Frame 1

How Could the Sender Know which Frame does an ACK correspond to?

BY INCLUDING THE

SEQUENCE NUMBER IN

THE ACK

Sender Receiver

ACK

Frame 0

Frame 0

Frame 1

ACK

Frame 2

ACK

C

Timeout

Page 6: Arq protocol part 2

Stop-and-Wait ARQ PerformanceStop-and-Wait ARQ Performance

The Channel Idle Time (Wait for ACK) is an Inefficiency because the channel is not used

Machine A Machine B

Physical Channel

First Frame-Bit enters Channels

Last Frame-Bit enters Channels

First Frame-Bit arrives at B

Last Frame-Bit arrives at B

Last ACK-Bit Arrives at A

Processing Time

Channel is Idle

Page 7: Arq protocol part 2

Stop-and-Wait ARQ EfficiencyStop-and-Wait ARQ EfficiencyMachine A Machine B

Physical Channel

t0=Total Time to Transmit 1 Frame

tprop

tf=Lf/R

tproc

ta=La/R

tprop

tproc

t0=2tprop+2tproc+tf+ta

t0=2tprop+2tproc+Lf/R+La/R

tprop Propagation Timetproc Processing Timetf Frame Transmission Timeta ACK Transmission TimeLf No. of Bits/FrameLa No. of Bits/ACK

Page 8: Arq protocol part 2

0

No. of Inormation Bits per Frame

Time Required to Deliver One Framef h

eff

L LR

t

−= =

Error-Free ChannelError-Free Channel

( )No Error0

1

η2

1

−−

= = =+

+ +

h

eff f h f

proc propa

f f

LR L L L

R Rt R t tLL L

Effective Transmission RateHeaders and

CRC

Transmission Efficiency Effect of Header

Effect of ACK

Effect of Delay Bandwidth Product

η Efficiency Assuming ERROR FREE CHANNNELNENo Errorη

Page 9: Arq protocol part 2

Go-Back-N BasicsGo-Back-N Basics

Transmit without waiting for ACKEach frame received correctly is

acknowledged with a sequence number corresponding to the NEXT frame expected

The receiver discards all out of sequence packets

If number of outstanding frames is WS:Go-Back-N

Page 10: Arq protocol part 2

What does WWhat does WSS Represent? Represent?

WS is called the sending window size Each frame must be buffered (stored)

until a valid ACK arrives (in case retransmission is needed)

WS represents the maximum number of frames that may be outstanding (i.e., stored) simultaneously

Page 11: Arq protocol part 2

Go-Back-N ARQ Go-Back-N ARQ ProtocolProtocol

An outstanding frame:

It is a frame that has been

transmitted and is yet to be acknowledged

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Fr_3

Fr_4

Fr_5

Fr_6

Fr_7

Fr_8

ACK_4

ACK_5

ACK_6

ACK_7

ACK_8

At this Point there are

WS=4 Outstanding Frames. So,GO-BACK-4

Out of Sequence

Frames. So, do not accept

them

Page 12: Arq protocol part 2

Time-out Driven Go-Back-NTime-out Driven Go-Back-N

For Go-Back-N with Ws = 4◦ What happens if the

sender only has 2 frames to send No retransmission is

triggered because the window is not full

Time-out Driven Go-Back N◦ Timer per

outstanding frame◦ If the window is full no

further transmissions are allowed

Sender Receiver

Fr_0

Fr_1

ACK_1

Fr_0

Fr_1

ACK_2

TimeoutOut of

sequence, ignored

Page 13: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_2

Fr_3

Page 14: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_2

Fr_3

Page 15: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_2

Fr_3

Page 16: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_2

Fr_3

Page 17: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_1

Fr_2

Fr_3

Fr_4

Page 18: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_2

Fr_3

Fr_4

Fr_5

Page 19: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_3

Fr_4

Fr_5

Fr_6

Page 20: Arq protocol part 2

Sliding Window ConceptSliding Window Concept Go Back N is an example of what is called a sliding window protocol An ACK received means that all previous frames have been received

correctly (previous ACKs were lost or receiver chose not to send them)

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

Fr_6

ACK_1

ACK_2

ACK_3

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_4

Fr_5

Fr_6

Fr_7ACK_4

Transmitter has nothing to send

Page 21: Arq protocol part 2

Header Bits for SequencingHeader Bits for Sequencing

The frame sequence numbers cannot be allowed to keep on increasing to infinity. WHY?◦ Headers must be limited in size◦ An increase in header size means inefficiency

If m bits are devoted for carrying the sequence numbers◦ Frame sequence numbers may go from 0 up to 2m-1

IMPORTANT REQUIREMENT: The receiver must have the ability to unambiguously identify the received frame◦ Window Size MUST BE smaller than 2m

Page 22: Arq protocol part 2

Go-Back-N ARQ: sender window size

Page 23: Arq protocol part 2

Selective Repeat ARQ ProtocolSelective Repeat ARQ Protocol

What is the problem of Go-Back N?Go Back-N retransmits the erroneous

frame and all subsequent framesThis reduces efficiency especially for

High Error ChannelsSelective Repeat ARQIntroduce a receive window to store

CORRECT out of sequence framesRetransmit individual frames

TCP uses a form of selective repeat

Page 24: Arq protocol part 2

Error Recovery in Selective Error Recovery in Selective Repeat ARQRepeat ARQ

Sender Receiver

Fr_0

Fr_1

Fr_2

Fr_3

Fr_4

Fr_5

ACK_1

ACK_2

NAK_2

Fr_2

ACK_2

ACK_2

Fr_6 ACK_6

ACK_7

Page 25: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_0

Fr_1

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

WS=WR=2 , m=2

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

Page 26: Arq protocol part 2

Operation of Selective RepeatOperation of Selective RepeatWS=WR=2 , m=2

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_0

Fr_1

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

Page 27: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_0

Fr_1

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 28: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_0

Fr_1

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 29: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_0

Fr_1

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 30: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_0

Fr_1

Fr_2

Fr_3

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 31: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_2

Fr_3

Fr_2

Fr_3

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 32: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_2

Fr_3

Fr_2

Fr_3

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 33: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_2

Fr_3

Fr_3

Fr_0

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 34: Arq protocol part 2

Operation of Selective RepeatOperation of Selective Repeat

Sending Window

Frame Sequences that are allowed to be sent

Outstanding Frame Sequences

Fr_2

Fr_3

Fr_3

Fr_0

Frame Sequences that are allowed to be received

Frame Sequences that are received correctly and buffered

Receiving Window

Sender Receiver

Fr_0

Fr_1

Fr_0

NAK_0

ACK_2

Fr_2

ACK_3Fr_3

ACK_0

WS=WR=2 , m=2

Page 35: Arq protocol part 2

Selective Repeat ARQ, sender window size