stop and wait

628 views 24 slides Apr 27, 2023
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

kk


Slide Content

FLOW AND ERROR CONTROL

FLOW AND ERROR CONTROL
Themostimportantresponsibilitiesofthedatalink
layerareflowcontrolanderrorcontrol.Collectively,
thesefunctionsareknownasdatalinkcontrol.
Flow Control
Error Control
Topics discussed in this section:

Flow control refers to a set of procedures
used to restrict the amount of data
that the sender can send before
waiting for acknowledgment.
Note

Error control in the data link layer is
based on automatic repeat request,
which is the retransmission of data.
Note

PROTOCOLS
Nowletusseehowthedatalinklayercancombine
framing,flowcontrol,anderrorcontroltoachievethe
deliveryofdatafromonenodetoanother.The
protocolsarenormallyimplementedinsoftwareby
usingoneofthecommonprogramminglanguages.To
makeourdiscussionslanguage-free,wehavewritten
inpseudocodeaversionofeachprotocolthat
concentratesmostlyontheprocedureinsteadof
delvingintothedetailsoflanguagerules.

Taxonomy of Flow and error control protocols

NOISELESS CHANNELS
Letusfirstassumewehaveanidealchannelinwhich
noframesarelost,duplicated,orcorrupted.We
introducetwoprotocolsforthistypeofchannel.
Simplest Protocol
Stop-and-Wait Protocol
Topics discussed in this section:

Itisverysimple.Thesendersendsasequenceofframes
withouteventhinkingaboutthereceiver.Tosendthree
frames,threeeventsoccuratthesendersiteandthree
eventsatthereceiversite.Notethatthedataframesare
shownbytiltedboxes;theheightoftheboxdefinesthe
transmissiontimedifferencebetween
thefirstbitandthelastbitintheframe.
Simplest Protocol

Figure 1 Flow diagram for Simplest Protocol

AlgorithmSender-site algorithm for the simplest protocol

Algorithm Receiver-site algorithm for the simplest protocol

Itisstillverysimple.Thesendersendsoneframeand
waitsforfeedbackfromthereceiver.WhentheACK
arrives,thesendersendsthenextframe.
Stop-and-wait protocolworks under the assumption
that the communication channel isnoiselessand
transmissions areerror-free.
Working:
•The sender sends data to the receiver.
•The sender stops and waits for the acknowledgment.
•The receiver receives the data and processes it.
•The receiver sends an acknowledgment for the above
data to the sender.
•The sender sends data to the receiver after receiving
the acknowledgment of previously sent data.
•The process is unidirectional and continues until the
sender sends theEnd of Transmission (EoT)frame
Stop and Wait Protocol

Figure 2 Flow diagram for Example 11.2
Notethatinfigure2,sendingtwoframesin
theprotocolinvolvesthesenderinfourevents
andthereceiverintwoevents.

AlgorithmSender-site algorithm for Stop-and-Wait Protocol

Algorithm Receiver-site algorithm for Stop-and-Wait Protocol

NOISY CHANNELS
AlthoughtheStop-and-WaitProtocolgivesusanidea
ofhowtoaddflowcontroltoitspredecessor,noiseless
channelsarenonexistent.Wediscussthreeprotocols
inthissectionthatuseerrorcontrol.
Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request
Topics discussed in this section:

Error correction in Stop-and-Wait ARQ is
done by keeping a copy of the sent
frame and retransmitting of the frame
when the timer expires.
Note

In Stop-and-Wait ARQ, we use sequence
numbers to number the frames.
The sequence numbers are based on
modulo-2 arithmetic.
Note

In Stop-and-Wait ARQ, the
acknowledgment number always
announces in modulo-2 arithmetic the
sequence number of the next frame
expected.
Note

Stop-and-Wait ARQ
1.Itprovidesbotherrorcontrolandflowcontrol
2.ErrorcontrolinstopandwaitARQisdonebykeepinga
copyofframeuntilitreceivesaacknowledgement
3.Senderstartatimerwhenitsendaframe.IfACKisnot
receivedwithintheallocatedtimeperiod,thesender
assumethattheframewaslostordamageandresent
it.
4.ReceiversendanACKtosenderifitreceivesaframe
correctly.
5.ACKnumberalwaysdefinethenumberofthenext
expectedframe.
Stop and wait ARQ = Stop and wait + Time out + Sequence
Number (Data) + sequence number (ACK))
1.

Stop-and-Wait ARQ
For identification, both data frames and
acknowledgements (ACK) frames are numbered
alternatively 0 and 1.
Sender has a control variable (S) that holds
the number of the recently sent frame. (0 or
1)
Receiver has a control variable ® that holds
the number of the next frame expected (0 or
1).

Figure3showsanexampleofStop-and-WaitARQ.
Frame0issentandacknowledged.Frame1islostand
resentafterthetime-out.Theresentframe1is
acknowledgedandthetimerstops.Frame0issentand
acknowledged,buttheacknowledgmentislost.The
senderhasnoideaiftheframeortheacknowledgment
islost,soafterthetime-out,itresendsframe0,whichis
acknowledged.
Stop-and-Wait ARQ

Figure 3 Flow diagram for Example 11.3

Disadvantage of Stop-and-Wait

In stop-and-wait, at any point in time, there is only one frame that is sent
and waiting to be acknowledged.

This is not a good use of transmission medium.

To improve efficiency, multiple frames should be in transition while
waiting for ACK.

Two protocol use the above concept,

Go-Back-N ARQ

Selective Repeat ARQ
Tags