Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount...

52
Data Link Layer Flow and Error Control

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

Transcript of Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount...

Page 1: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Data Link LayerFlow and Error Control

Page 2: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 3: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 4: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

ARQAutomatic Repeat reQuestA flow and error control

mechanism which uses:◦Error detection◦Timers◦Acknowledgements◦Retransmissions

Page 5: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 6: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 7: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 8: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Stop-and-Wait Protocol

Page 9: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 10: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Stop-and-Wait ProtocolSource waits for ACK until timer expiresTimeout =Tfram+2Tprop+Tack=2(Ttrans+Tprop)

Page 11: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 12: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 13: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 14: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 15: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 16: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Sliding Window Protocol

Page 17: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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)

Page 18: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 19: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Sliding Window Protocol

Page 20: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 21: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 22: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 23: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Sliding Window Example

RR = Receive Ready

window size = 7 segments

Page 24: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Go-Back-NProtocol

Page 25: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 26: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 27: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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)

Page 28: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 29: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 30: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Selective Repeat

Protocol

Page 31: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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)

Page 32: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Selective Repeat Protocol

Receiver sends all frames to higher layer in order

Window protocol just like Go-Back-N

Window size W

Page 33: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 34: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Selective Repeat ProtocolWhen Frame 2 received correctly, receiver can sends Frames 2-5 to its Network layer and send ACK 6 back to Sender

Page 35: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 36: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Link Utilization

Page 37: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 38: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Stop-and-Wait Link Utilization

Page 39: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 40: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 41: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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)

Page 42: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Stop-and-Wait Timing

tframe = 1, tprop = a

Page 43: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Stop-and-Wait Performance

a = Rd/VL

Page 44: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 45: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 46: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Error-Free Sliding Window ARQCase 1: W ≥ 2a + 1

Ack for frame 1 reaches A before A has exhausted its window

Page 47: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

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

Page 48: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Normalized Throughput Error-Free Sliding Window ARQ

1 ; W ≥ 2a + 1

U = W ; W 2a +1 1 + 2a W times stop-and-wait throughput

Page 49: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Selective Repeat ARQ

1 - P ; W ≥ 2a + 1

U = W(1 - P) ; W 2a

+1 2a + 1

W times stop-and-wait (error) throughput

Page 50: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Go-Back-N ARQ

1 - P W ≥ 2a + 1

1 + 2aPU = W(1 - P) W

2a +1 (2a + 1)(1 – P + WP)

Why?

Page 51: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

Sliding Window Utilization• Utilization decreases as a increases• Utilization increases as window size increases• Larger window is better, specifically for larger

a

Page 52: Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.

ARQ Utilization (P = 10-3)