1 Data link layer (basic) – no MAC sublayer • Outline – Two functions • Error control • Flow control Malathi Veeraraghavan Univ. of Virginia Some of the figures in this talk are from A. Tanenbaum's book and a few from A. Leon-Garcia and I. Widjaja’s book
Data link layer (basic) – no MAC sublayer. Outline Two functions Error control Flow control. Malathi Veeraraghavan Univ. of Virginia. Some of the figures in this talk are from A. Tanenbaum's book and a few from A. Leon-Garcia and I. Widjaja’s book. Error control. Error detection - PowerPoint PPT Presentation
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.
Transcript
1
Data link layer (basic) – no MAC sublayer
• Outline– Two functions
• Error control• Flow control
Malathi Veeraraghavan Univ. of Virginia
Some of the figures in this talk are from A. Tanenbaum's bookand a few from A. Leon-Garcia and I. Widjaja’s book
2
Error control
• Error detection– Parity check– Cyclic Redundancy Code (CRC) or
In Physical Layer lecture, we learned the word"bandwidth" as H in Hz. We used the word "transmission rate" as rin bits/sec, which determines emission (transmission) delay.On this slide, we are using the word "Bandwidth" for transmission rate, r. Commonly accepted language in networking community.
1 sec x 109 b/s= 109 bits
11
Transmission efficiency, 0
nf = 1250 bytes = 10000 bits
na =no= 25 bytes = 200 bits
1 ms 10 ms 100 ms 1 sec
1 Mbps 88% 49% 9% 1%
1 Gbps 1% 0.1% 0.01% 0.001%
Round-tripprop. delay
BW
The higher the bandwidth-delay product, the lower thetransmission efficiency or effective transmission rate
12
We conclude that
• Stop-and-Wait ARQ solution does not work well on high bandwidth-delay product paths
13
Error correction:Different ARQ schemes
• Stop-and-WaitSliding window
14
Sliding window scheme
Basic operation (no errors/losses)• Relation between sending window size and
sequence number
15
Basic operation• Improve Stop-and-Wait by not waiting!• Keep channel busy by continuing to send
frames
• Transmit a window of Ws frames before waiting for an ACK
• If ACK for oldest frame arrives before window is exhausted (which means before sender has transmitted out Ws frames), then there is no "WAIT" period. Leads to an efficient use of the link.
16
Sequence numbers and ACKs
• Sequence numbers in frame headers– Add a sequence number in each frame header– Use an m-bit sequence number to identify frames
• Example: if m=3, sequence numbers are 0, 1, 2, 3, 4, 5, 6, 7. The next frame will start over with sequence number 0.
• ACK frames– ACK frame carries the sequence number of the next
expected frame• Called cumulative ACK• More efficient to say "I received everything up to this frame and
am expecting this next frame" rather than to ACK every frame one-by-one.
17
New term: outstanding frames
• Means unacknowledged• At any instant of time, there can
be only Ws outstanding frames – these frames were transmitted but
the sender has not yet received an ACK for any of the frames
18
Operation of Sliding Window Scheme
• Sending window vs. permitted-to-send window:– Permitted-to-send window: set of frames that the sender is permitted to
• Sending window size, Ws, should be at least as large as W (previous slide) so that no time is wasted waiting for an ACK with the sender idling
12
f
props
s
n
RtW
WW
In most protocols, frames are of variable length, and therefore window size is usually expressed in bytes. For simplicity, in this lecture, we have assumed that all frames are of equal length (size Sf). Under this assumption, Ws should always be an integer, as it represents a number of fixed-length frames.
24
Sliding window scheme outline check
• Basic operation (no errors/losses)Relation between sending window
size and sequence number
25
A
B
fr0
Timefr1
fr2
fr3
fr0
ACK1
Example: m=2 and Ws = 4
ACK0
ACK2
ACK3
Sender timer times out for frame 0 since ACK is not receivedand sender retransmits frame 0
Receiver has Rnext= 0; so it will accept the frame assuming it is a new frame, when in reality it is a duplicate frame
What happens if sending window size Ws = 2m?
Rnext 0 1 2 3 0
Rnext: Sequence number of the next expected frame
ACKslost
26
Conclusion: Maximum Allowable Sending Window Sizemax(Ws) = 2m-1
A
B
fr0
Timefr1
fr2
fr0
ACK1
ACK2
ACK3
Receiver has Rnext= 3 , so it rejects the duplicate frame 0, and sends ACK 3. If this ACK reaches the sender, sender will conclude that frames 0, 1 and 2 were successfully received and it will send frame 3
Rnext 0 1 2 3
Example: m=2 and Ws = 3 Sender timer times out for frame 0 since ACK is not receivedand sender retransmits frame 0
fr3
ACK3
ACKslost
27
Relation between sending window size and sequence number
• Sending window size, Ws
• Sequence number is m-bits long
12 msW
28
Transmitter ReceiverDATA
DATATransmitterReceiver
ACK Piggybacking in Bidirectional Communication
A B
S: Sequence number of frameRnext: Next expected frame at the receiver: ACK number
In normal operation, what can we say about the relation between SB and RA
next?
Frames have sequence numbers; ACKs have numbersPiggybacking means carrying an ACK number within data-carrying frame header
BnextR
AnextR
BS
AS
HeaderTrailer
29
Status check
• Outline– Two functions
• Error controlFlow control
30
Flow control problem
• Rates of the transmitter and receiver at the physical layer are matched. • The flow control problem arises because the layer above the DLL at the
receiver does not deplete the buffer at the same rate at which data is being passed to the DLL at the sender (Rsnd Rrcv)
Data-link layer (DLL) Data-link layer (DLL)
Physical layerPhysical layer
Host Switch or host
Data units Receivebuffer
H
T
T H
H
T
Rsnd Rrcv
transmission rate: r
31
Different rates
• Rsnd: Rate at which the higher layer passes data to the DLL at the sender
• Rrcv: Rate at which the higher layer removes data from the DLL buffer at the receiver
• r: physical-layer transmission rate
32
Techniques for flow control
• Flow control mechanisms prevent buffer overflow by regulating the rate at which source is allowed to send information– Stop-and-wait flow control– ON-OFF flow control– Sliding window flow control– Rate based flow control (skip for this
class)
33
Stop-and-wait flow control
• No problem if ACK is sent back after higher layer depletes the buffer holding the single frame’s payload
34
Sender Receiver
BleftOFF2tprop
Assume that the physical-layertransmission rate, r, is same as Rsnd
Bleft=2tprop(Rsnd – Rrcv)
B
ON /OFF flow control
When should the OFF signal be sent?
Recall:What is Rsnd?What is Rrcv?
Round-trippropagationdelay
35
Sliding Window Flow Control
• Sliding Window Flow Control– Receiver has a receive buffer– Receiver sends reports of available space in
this buffer to the sender• This is called flow window or advertised window
– Sender uses this number to determine the maximum number of frames it can have outstanding (i.e., unacknowledged)
36
Sliding window FC illustrated
Sending bufferIf m=3, i.e. 3-bit sequence number,
then Ws can be 7, why?
Receiving buffer(flow control)
Ws=7
flow window = 11
Receivebuffercanhold11 frames
Receiver notifies thesender as to how muchspace is availablein its receive buffer
37
Sliding window FC illustrated
65
34
210
Sending buffer Receiving buffer
Ws=7
210
flow window = 8; ack 3
Because the receiving buffer has space to hold 8 more packets
Because the receiver is expecting packet with sequence number 3
Since 0, 1, 2 are ACK'ed, they can be removed from the send buffer
38
Flow window
• Flow window is the:– Left-over space in the receiver’s buffer– In previous slide, flow window of 8 is a
report of how much space is left in the receiver’s buffer (enough to hold 8 frames)
• Flow window is also called "advertised window" or "receiver’s window"
39
Sliding window FC illustrated
65
34
Sending buffer Receiving buffer
Ws=7 65
34
210
flow window = 4; ack 2
70
1
70
1
Watch with animation; frames 0, 1, 2 are read outof the receive buffer by the higher-layer, which iswhy the flow window indication is 4
40
At any instant in time, what is the maximum number of frames that the sender is permitted to
send?• Maximum number of outstanding frames at any instant in time is a minimum
of sending window,Ws, and the flow window indicated by the receiver• Three steps:
1. Find X = min (Ws, flow window)
2. Find Y = number of outstanding frames (already sent but unacknowledged)
3. Maximum number of frames that the sender is permitted to send = X- Y
• Result: if X-Y frames are sent, then the number of outstanding frames will become X (which is the max. limit for no. of outstanding frames)
• After the sender receives the indication that flow window = 4 and ACK = 2 as shown on the previous slide, how many frames can the sender send? What are the sequence numbers of the frames that it will send (assume that the higher-layer keeps passing frames down to the DLL at the sender)?