data link control and protocols
DESCRIPTION
Data Link Control and Protocols. Flow and Error Control. Flow Control. Error Control. Note :. 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 :. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/1.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Data LinkControl
andProtocols
![Page 2: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/2.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Flow and Error ControlFlow and Error Control
Flow Control
Error Control
![Page 3: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/3.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Flow control refers to a set of Flow control refers to a set of procedures used to restrict the amount procedures used to restrict the amount of data that the sender can send before of data that the sender can send before
waiting for acknowledgment.waiting for acknowledgment.
NoteNote::
![Page 4: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/4.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
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.
NoteNote::
![Page 5: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/5.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Flow Control Protocols
Stop and Wait Protocol Sliding Window Protocol
![Page 6: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/6.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Stop and Wait Protocol
Data transmission is in one direction at a time (half-duplex)
Sender sends a frame and waits for an acknowledgement
Avoids flooding frames at receiving end
Receiver holds the data in buffer Once complete frame is received, then
the acknowledgement is sent i.e. it is ready to receive another frame
![Page 7: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/7.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Stop and Wait Protocol
Only one frame is transmitted at a time Time taken by a station to transmit a
frame is ‘transmission time’ Time taken by a bit to reach destination
from source is ‘propagation time’ Capacity of medium: Length of link in Bits Calculated as: B=R x (d / v)
where, R is Data rate of Link in bps d is length of link in meters v is velocity of propagation
![Page 8: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/8.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Two Cases of Stop and Wait Protocol Case 1: When transmission time
(t=1) is greater than propagation time
Case 2: When propagation time (a) is greater than transmission line
![Page 9: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/9.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Case 1: a<1
i.e. propagation time is less than transmission time
Frame is so long that, the first bit of frame reaches the destination before the source completes transmitting the whole frame
Case when the sender and receiver are at very short distance
Eg: LAN Communication
![Page 10: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/10.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Numerical Example for a<1 Medium capacity (B)=200 bits( R=1Gbps, d=40m,
v=2x108m/s) Transmission time=1 second Frame size (L)=800 bits Propagation time (a)= B/L=200/800=0.25= 250 ms At t0, transmission starts After 250 ms, first 200 bits are on transmission line After 1000 ms, final bit of frame is emitted to medium After 1250 ms, final bit reaches the receiver If Ack takes 250 ms to reach sender Total Transmission Time= (1250 +250)=1500ms The Actual Transmission Time for first frame=
1000ms Total Transmission Time =1500ms
![Page 11: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/11.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Case 1: a>1
i.e. propagation time is greater than transmission time
Sender finishes transmitting complete frame before the first bit of frame could reach the destination
The medium is under utilized as the medium is never fully occupied during the frame transmission
Case when the distance between sender and receiver is very long
Eg: Satellite Communication
![Page 12: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/12.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Numerical Example: a>1 Medium capacity (B)=10000 bits ( R=1Mbps,
d=30000m, v=3x106m/s) Transmission time=1 second Frame size (L)=800 bits Propagation time (a)= B/L=10000/800=25 seconds At t0, transmission starts After 1s, final bit of frame is emitted to medium After 25seconds, first bit of frame reaches the
receiver After 26seconds, final bit reaches the receiver If Ack takes 25s to reach sender Total Transmission Time= (26 +25)=51 seconds The Actual Transmission Time = 25seconds Total Transmission Time =51seconds>>25seconds
![Page 13: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/13.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
So concluding stop and wait... Medium Capacity increases if data rate
increases as well as if distance increases
If capacity increases, propagation time will also slowly increase keeping other values constant
Which slowly degrades the efficiency More the propagation delay is, more
inefficient is the stop and wait protocol
![Page 14: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/14.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Sliding Window Protocol
Introduced to overcome the limitation of stop and wait protocol of sending only one frame at a time
Sends multiple frames say W frames (window-size) Receiver will have buffer size for W frames Sender is allowed to send W number of frames
without waiting for an acknowledgement To keep track of frames acknowledged, sequence
number is used The number of bits used in sequence number
determines the value of W Sender’s window will constitute of frames sent but
not acknowledged Receiver’s window will constitute of frames
expected
![Page 15: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/15.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Sliding Window Protocol
Whenever receiver receives a frame correctly, it sends a acknowledgement for that frame, and then slides the window next expected frame adding new expected frame to the window
Whenever sender receives an acknowledgement for a frame it sends next frame to receiver and slides the window one frame maintaining window size
![Page 16: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/16.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
How to number frames?
Frames are numbered using sequence number
If there is 3 bit sequence number, then the maximum possible sequence number is 7
And maximum window size:0-7, i.e 8 But not always max. window size is the
required window size The window size of the frames depend
upon protocols used
![Page 17: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/17.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Piggybacking
Until now only unidirectional data flow is discussed But what if bidirectional data flow is required What if both station A and B needs to send data At such case, it would be inefficient use of medium
to send acknowledgement and data separately Since Acknowledgement is a small piece of
information, it would be efficient to append the acknowledgement information with next out-going data
This technique of combining a data frame with an acknowledgement in bidirectional transmission system to make the optimum use of the medium is called piggy-backing
![Page 18: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/18.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Different Sliding Window Protocols for Error Control One Bit Sliding Window Protocol Go-Back N ARQ (Automatic Repeat
reQuest) Selective Repeat ARQ
![Page 19: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/19.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
One-Bit Sliding Protocol
Also known as Stop and Wait ARQ Follows the principle of stop and wait
protocol The window size at receiver and
sender is 1 frame
![Page 20: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/20.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
One-Bit Sliding Protocol (Features) Sender keeps a copy of frame sent until the
acknowledgement for that frame is received Data frames and acknowledgement frames are identified
with two values 0 and 1 Data frame 0 is acknowledged by ACK 1 and vice versa If receiver receives damaged frame, then it simply discards
the frame and doesn’t send an acknowledgement If receiver receives out of order frame, then also it discards
the frame and sends no acknowledgement Sender starts timer as soon as it sends a frame and if it
doesn’t receive acknowledgement before the timer goes off, it retransmits the frame
In case of unidirectional transmission, sender has control variable S to store the number of recently sent frame (0 or 1) and receiver has control variable R to store the number of next frame expected
In bidirectional transmission, each station have both control variables
![Page 21: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/21.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Normal operation of One Bit Sliding Protocol
![Page 22: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/22.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Stop-and-Wait ARQ, lost frame
![Page 23: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/23.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Stop-and-Wait ARQ, lost ACK frame
![Page 24: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/24.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
In Stop-and-Wait ARQ, numbering In Stop-and-Wait ARQ, numbering frames prevents the retaining of frames prevents the retaining of
duplicate frames.duplicate frames.
NoteNote::
![Page 25: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/25.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Stop-and-Wait ARQ, delayed ACK
![Page 26: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/26.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Numbered acknowledgments are Numbered acknowledgments are needed if an acknowledgment is needed if an acknowledgment is
delayed and the next frame is lost. delayed and the next frame is lost.
NoteNote::
![Page 27: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/27.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Piggybacking in Stop and Wait ARQ
![Page 28: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/28.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Go-Back-N ARQ
Multiple frames can be sent without waiting for the acknowledgments
If m bits are used for sequence number, the maximum possible window size that can be used by sender is 2m-1
The receiver window size is always 1 frame window
![Page 29: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/29.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Sender sliding window in Go-Back-N ARQ
![Page 30: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/30.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Receiver sliding window in Go-Back-N ARQ
![Page 31: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/31.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Control variables in Go-Back-N ARQ
![Page 32: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/32.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Go-Back-N ARQ (Operation) Multiple frames are sent in this protocol by sender If the receiver doesn’t receive the frame or the
frame is damaged then, the acknowledgment is not sent
Also the receiver discards all the subsequent frames followed by erroneous frame
Receiver also discards all the out of order frames When sender doesn’t get an acknowledgment before
the timer goes off, it retransmits all the frames all over again starting from frame whose acknowledgement is not received
Acknowledgment can be sent by receiver in the cumulative form as well
![Page 33: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/33.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Go-Back-N ARQ, normal operation
![Page 34: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/34.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Go-Back-N ARQ, lost frame
![Page 35: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/35.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Go-Back-N ARQ: sender window size
![Page 36: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/36.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
11.4 Selective-Repeat ARQ11.4 Selective-Repeat ARQ
Sender and Receiver Windows
Operation
Sender Window Size
Bidirectional Transmission
Pipelining
![Page 37: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/37.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Selective Repeat ARQ
Go-Back-N ARQ would not be efficient protocol with noisy channel where the tendency of error is high resulting high number of retransmissions
So for such scenario, there should be mechanism to not resend all N frames but just to send the frame which is damaged
Selective Repeat ARQ provides such mechanism
Sender and Receiver have same window size which is equal to at most 2m/2
There is use of NAK (Negative ACK) for damaged frames
![Page 38: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/38.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
11.12 Selective Repeat ARQ, sender and receiver windows
![Page 39: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/39.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Selective Repeat ARQ(Operation) In selective repeat, if receiver
encounters a damaged frame it sends NAK
When sender receives a NAK, it resends the frame for which the NAK was sent by receiver
Timers are used at both ends to tackle the problem when the frames, ACKS and NAKS are delayed or lost
![Page 40: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/40.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
11.13 Selective Repeat ARQ, lost frame
![Page 41: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/41.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
In Selective Repeat ARQ, the size of In Selective Repeat ARQ, the size of the sender and receiver window must the sender and receiver window must
be at most one-half of 2be at most one-half of 2mm. .
NoteNote::
![Page 42: Data Link Control and Protocols](https://reader031.vdocuments.us/reader031/viewer/2022033022/56813595550346895d9d0935/html5/thumbnails/42.jpg)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
11.14 Selective Repeat ARQ, sender window size