Upload
donald-rich
View
253
Download
0
Embed Size (px)
DESCRIPTION
Flow Control Flow control Flow control Faster than ◦ Sender transmits Faster than receiver can process them Drop ◦ Receiver will be forced to Drop some frames Signaling Signaling Slow Down rate acceptable ◦ Signaling the sender to Slow Down to a rate acceptable to the receiver Explicit or Implicit ◦ Signaling can be Explicit or Implicit ◦ e.g., delay in sending back ACK to sender
Citation preview
Data Link LayerFlow and Error Control
Flow ControlFlow Control
Specifies the amount of data can be transmitted by sender before receiving permission to continue from receiver
Error Control Allows receiverTo find damaged or lost frames during transmissionTo coordinate re-transmission of those frames by sender
Flow Control & Error Control Flow control must acknowledge the correctly-received frames, So it is closely linked to error control
Flow ControlFlow control
◦Sender transmits Faster than receiver can process them
◦Receiver will be forced to Drop some frames
Signaling◦Signaling the sender to Slow Down to
a rate acceptable to the receiver◦Signaling can be Explicit or Implicit◦e.g. , delay in sending back ACK to sender
ARQAutomatic Repeat reQuestA flow and error control
mechanism which uses:◦Error detection◦Timers◦Acknowledgements◦Retransmissions
If error(s) is detected in received Frame, return NAK to sender
NAK can be explicit or implicit (Expiration of
sender Timer)
Sender starts a timer for each frame
Timeout value = Expected delay for sender to receive ACK for frame
Automatic Repeat Request
Sender keeps a copy of each un-ACKed frame to re-transmit if required◦ If ACK is received, discarding the copy◦ If NAK is received (timer expired), re-transmit frame
ACK can be a separate frame or a control field Piggybacked in data frame going from receiver to sender
Automatic Repeat Request
Automatic Repeat Request
Flow and error control techniques at link layer◦ Stop-and-wait Protocol◦ Go-back-N Protocol◦ Selective-reject Protocol (A.K.A. selective
repeat)◦ Sliding window Protocol
Stop-and-Wait Protocol
Stop-and-Wait ProtocolEach frame is assigned a Sequence NumberSource transmits A Frame (e.g., frame SN= i) and
waits for ACKnowledgementReceiver acknowledges the receipt by sending back
ACK ACK includes the Request Number (RN) of next
frame (i+1) This implicitly says that frame i is Error-Free If frame i is in error, receiver discards it and sends
ACK including RN=i
Stop-and-Wait ProtocolSource waits for ACK until timer expiresTimeout =Tfram+2Tprop+Tack=2(Ttrans+Tprop)
Stop-and-Wait ProtocolRetransmission, if timer expires & ACK not received Frames are sequenced as 0, 1, 2, …, m It is shown that for m>=1, transmissions have no
conflict Minimum possible frame sequence m=1 (0, 1, 0, 1, 0,
1, 0,)Transmission Errors
◦ Lost data frame◦ Damaged data frame at destination◦ Lost ACK
Stop-and-Wait ARQ
Lost Frame• Source sends Data Frame and waits for ACK• Data Frame is lost• No ACK is replied by receiver• Timer expires• Source Retransmits the frame
Stop-and-Wait ARQDamaged Frame at destination• Destination receives frame 1 in error• NACK is sent back (No ACK & Timer expires)• Sender knows Frame 1 is in error• Source Retransmits frame 1
Stop-and-Wait ARQ
Lost ACK• Frame1 is received at destination• Destination sends ACK 0• Source does not receive ACK 0• Timer expires• Source Retransmits Frame 1 • Destination Discards duplicated
Frmae1
Stop-and-Wait Link UtilizationSource sends a single frame and waits for
Tfram+2Tprop+Tack=2(Ttrans+Tprop) Tprop is large relative to Ttrans
Propagation delay is long relative to transmission timeTransmission of only one frame at a timeWaiting for a long time to receive ACKLink is mostly idle
Stop-and-Wait Protocol Reduces Link Utilization
Sliding Window Protocol
Sliding Window ProtocolAllows Multiple Frames to be Transmitted at
the same timeTransmitter and receiver have sequence
numbers nt and nr
Frames and ACKs must be numberednt denotes the next frame to be transmitted i.e. the sequence number of the first frame not yet
transmitted
nr is the first packet not yet received (Expected)
Sliding Window Protocol Transmitter and receiver have a window size wt
and wr Window size = # of frames that can be
transmitted without an ACK Transmitter sends wt frames continuously and wait
for ACK ACK Includes sequence nr Receiver can ACK frames without permitting
further transmission (Receive Not Ready=RNR) Receiver must send a normal ACK to resume
Sliding window becomes stop-and-wait if window size is One
Sliding Window Protocol
Sliding Window ProtocolTransmitter Operation
Transmitter needs to buffer so that if data is lost, it can be resent
Transmitter may transmit up to wt frame ahead of the latest acknowledgment na
It may transmit frame number nt, wherent < na+wt
It keeps the sent packets in buffer until ACK arrives
Sliding Window ProtocolReceiver Operation
Receiver needs to buffer so that if data is received out of order, it can be held until all packets are received
When a frame arrivesReceiver checks to see if the frame
number falls in the receive windowIf so, receiver accepts it and
updates nr If not, receiver discards it
Receiver sends ACK including current nr
Sliding Window ProtocolSliding Window in a nutshellSender can transmit several frames
continuously before needing an ACKIf ACK received by sender before
transmission is finished, sender can continue transmitting
An ACK can acknowledge the correct receipt of multiple frames at the Receiver
Frames may be ACKed by receiver at any time, and may be transmitted by sender as long as the window hasn’t filled up
Sliding Window Example
RR = Receive Ready
window size = 7 segments
Go-Back-NProtocol
Go-Back-N ProtocolMost common form of error control based on
Sliding Window
Window size W = N
Out of order (window) frames are discarded.
If frame F is in error◦ Receiver replies with rejection (REJ F / NACK)◦ Receiver discards frame F and all subsequent
frames until it receives frame F correctly
Go-Back-N ProtocolUpon receiving a NAK for frame F,
transmitter must Go Back and retransmit frame F and all subsequent frames
Sender resends frame F (and all subsequent frames) when timer expires too
If window W is selected large enough, sender can transmit continuously if there are no transmission errors
Go-Back-N Protocol NAK 3 means Retransmit Frame 3 (also tells sender
that all frames before frame 3 were received correctly)
Receiver discards all subsequent frames Receiver only accepts Correct Frames received in
Correct Order So, receiver doesn’t need to Buffer any frames (to
reorder them)
Go-Back-N ProtocolFrame 2 is lostReceiver is expecting Frame 2, But receives
Frame 3Frame 3 (4,5,…) is discarded (even though correctly
received)NAK is sent for Frame 2Frame 2 and All Subsequences are
Retransmitted
Go-Back-N Protocol
Piggybacking• When traffic is Bi-Directional , ACK can be
piggybacked on packets going in other direction • Each packet contains a• SN field indicating the packet sequence
number • RN field ACKs the packet in the other direction
• If there is no packet before timeout, acknowledge RN is sent
Selective Repeat
Protocol
Selective Repeat ProtocolSR attempts to retransmit only those
packets that are actually lost
Receiver does not discard the frames received after an error-frame
Receiver must be able to accept good frames out of order
Receiver stores the correct frames in a buffer and waits for error-frame (Buffering)
Selective Repeat Protocol
Receiver sends all frames to higher layer in order
Window protocol just like Go-Back-N
Window size W
Selective Repeat ProtocolNeed for Buffer Sender must buffer all frames until they are
ACKed ◦ Up to W un-ACKed frames
Receiver must buffer frames until they can be delivered in order
Up to W frames may have to be buffered at receiver◦ If the first frame is received in error
Selective Repeat ProtocolWhen Frame 2 received correctly, receiver can sends Frames 2-5 to its Network layer and send ACK 6 back to Sender
Selective Repeat ProtocolRetransmission StrategyReceiver ACKs the correct framesNot ACKed frames before time-out are
assumed lost or in error An explicit NAK (selective reject) can
request retransmission of just one frameNAK can expedite retransmission but is not
strictly needed Sender retransmits un-ACKed frame after a
timeout or upon a NAK
Link Utilization
Link Utilization (Efficiency)
Link Utilization is defined as the ratio of
portion of communication link used for sending user data
Tobandwidth of the link
User data rateLink data rate
Stop-and-Wait Link Utilization
ARQ Performance:Error-Free Stop-and-Wait
T = Tframe + Tprop + Tproc + Tack + Tprop + Tproc
Tframe = Time to transmit Frame (Ttrans)Tprop = Propagation timeTproc = Processing time at stationTack = Time to transmit ACK
Assume Tproc and Tack relatively small
Error-Free Stop and WaitT ≈ Tframe + 2Tprop (time required to send a frame)
Throughput = 1/T = 1/(Tframe + 2Tprop) frames/sec
Normalize to link data rate (frames/sec): 1/ Tframe
U = 1/(Tframe + 2Tprop) = Tframe = 1 1/ Tframe Tframe + 2Tprop 1 + 2a
where a = Tprop / Tframe
Parameter aa = Propagation Time = d/V =
Rd Transmission Time L/R
VL
whered = Distance (m)V = Propagation speed (m/s)L = Frame length (b)R = Link data rate (b/s)
Stop-and-Wait Timing
tframe = 1, tprop = a
Stop-and-Wait Performance
a = Rd/VL
Utilization (Example)Satellite LinkPropagation Delay tprop = 270 msFrame Size = 500 Bytes = 4 kbData rate = 56 kbps
⇒ tframe = 4kb/56kb = 71 ms ⇒ a = tprop/tframe = 270/71 = 3.8
U = 1/(2a+1) = 0.12
Short LinkPropagation Delay tprop = 5 μsData Rate = 10 MbpsFrame = 500 bytes
⇒ tframe = 4k/10M = 400 μs ⇒ a=tprop/tframe = 5/400 = 0.012
U=1/(2a+1)=0.98
Stop-and-Wait ARQwith Errors
P = probability a single frame is in error
Nt = 1 1 - P = average number of times each frame
must be transmitted due to errors
U = 1 = 1 – P Nt (1 + 2a) 1 + 2a
Error-Free Sliding Window ARQCase 1: W ≥ 2a + 1
Ack for frame 1 reaches A before A has exhausted its window
Error-Free Sliding Window ARQCase 2: W 2a +1
A exhausts its window at time t = W and cannot send additional frames until t = 2a + 1
Normalized Throughput Error-Free Sliding Window ARQ
1 ; W ≥ 2a + 1
U = W ; W 2a +1 1 + 2a W times stop-and-wait throughput
Selective Repeat ARQ
1 - P ; W ≥ 2a + 1
U = W(1 - P) ; W 2a
+1 2a + 1
W times stop-and-wait (error) throughput
Go-Back-N ARQ
1 - P W ≥ 2a + 1
1 + 2aPU = W(1 - P) W
2a +1 (2a + 1)(1 – P + WP)
Why?
Sliding Window Utilization• Utilization decreases as a increases• Utilization increases as window size increases• Larger window is better, specifically for larger
a
ARQ Utilization (P = 10-3)