E N D
Topic 2Data Link LayerPart B The majority of the slides in this course are adapted from the accompanying slides to the books by Larry Peterson and Bruce Davie and by Jim Kurose and Keith Ross. Additional slides and/or figures from other sources and from Vasos Vassiliou are also included in this presentation. DataLink Layer
Link Control Mechanisms 3 techniques at link level: • Stop-and-wait • Go-back-N • Selective-reject Latter 2 are special cases of sliding-window Assume 2 end systems connected by direct link DataLink Layer
Flow Control • Ensuring the sending entity does not overwhelm the receiving entity • Limits the amount or rate of data that is sent • Preventing buffer overflow • Source may send PDUs faster than destination can process headers • Higher-level protocol user at destination may be slow in retrieving data • Destination may need to limit incoming flow to match outgoing flow for retransmission DataLink Layer
Flow Control Scope • Hop Scope • Between intermediate systems that are directly connected • Network interface • Between end system and network • Entry-to-exit • Between entry to network and exit from network • End-to-end • Between end user systems DataLink Layer
Figure 11.2 DataLink Layer
Flow Control at Multiple Protocol Layers • Multiple TCP connections over HDLC link • Flow control at higher level applied to each logical connection independently • Flow control at lower level applied to total traffic DataLink Layer
Figure 11.1 DataLink Layer
Sequence of Frames Source breaks up message into sequence of frames • Buffer size of receiver may be limited • Longer transmission are more likely to have an error • On a shared medium, avoids one station monopolizing medium DataLink Layer
Model of Frame Transmission DataLink Layer
Automatic Repeat Request (ARQ) • Uses: • Error detection • Timers • Acknowledgements • Retransmissions • Algorithms • Stop and wait • Go back N • Selective reject (selective retransmission) DataLink Layer
Stop and Wait • Source transmits frame • Destination receives frame and replies with acknowledgement • Source waits for ACK before sending next frame • Destination can stop flow by not sending ACK • Works well for a few large frames DataLink Layer
Stop and Wait • 2 kinds of errors: • Damaged frame at destination • Damaged acknowledgement at source • If received frame damaged, discard it • Transmitter has timeout • If no ACK within timeout, retransmit • If ACK damaged,transmitter will not recognize it • Transmitter will retransmit • Receive gets two copies of frame • Use ACK0 and ACK1 DataLink Layer
Stop-and-Wait ARQ DataLink Layer
Figure 11.4 DataLink Layer
Stop-and-Wait Link Utilization • If Tprop large relative to Tframe then throughput reduced • If propagation delay is long relative to transmission time, line is mostly idle • Problem is only one frame in transit at a time • Stop-and-Wait rarely used because of inefficiency DataLink Layer
Fragmentation • Large block of data may be split into small frames • Limited buffer size • Errors detected sooner • On error, retransmission of smaller frames is needed • Prevents one station occupying medium for long periods • Stop and wait becomes inadequate DataLink Layer
Sliding Windows Flow Control • Allow multiple frames to be in transit • Receiver has buffer W long • Transmitter can send up to W frames without ACK • Each frame is numbered • ACK includes number of next frame expected • Sequence number bounded by size of field (k) • Frames are numbered modulo 2k DataLink Layer
Sliding Window DataLink Layer
Example of a Sliding Window Protocol DataLink Layer
Sliding Window Enhancements • Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) • Must send a normal acknowledge to resume • If duplex, use piggybacking • If no data to send, use acknowledgement frame • If data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP) DataLink Layer
Go-Back-N ARQ • Based on sliding window • If no error, ACK as usual with next frame expected • Use window to control number of outstanding frames • If error, reply with rejection • Discard that frame and all future frames until error frame received correctly • Transmitter must go back and retransmit that frame and all subsequent frames DataLink Layer
Go Back N - Damaged Frame • Receiver detects error in frame i • Receiver sends rejection-i • Transmitter gets rejection-i • Transmitter retransmits frame i and all subsequent DataLink Layer
Go Back N - Lost Frame (1) • Frame i lost and no additional frame sent • Receiver gets nothing and returns neither acknowledgement nor rejection • Transmitter times out and sends acknowledgement frame with P bit set to 1 • Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) • Transmitter then retransmits frame i DataLink Layer
Go Back N - Damaged Acknowledgement • Receiver gets frame i and send acknowledgement (i+1) which is lost • Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i • If transmitter times out, it sends acknowledgement with P bit set as before • This can be repeated a number of times before a reset procedure is initiated DataLink Layer
Go Back N - Damaged Rejection • As for lost frame (2) DataLink Layer
Go-Back-N ARQ Protocol DataLink Layer
Selective Reject • Also called selective retransmission • Only rejected frames are retransmitted • Subsequent frames are accepted by the receiver and buffered • Minimizes retransmission • Receiver must maintain large enough buffer • More complex login in transmitter DataLink Layer
Selective Reject - Lost Frame • Frame i lost • Transmitter sends i+1 • Receiver gets frame i+1 out of sequence • Receiver send reject i • Transmitter goes back to frame i and retransmits DataLink Layer
Selective Reject -Diagram DataLink Layer
Figure 11.7 DataLink Layer
Error-Free Stop and Wait T = Tframe + Tprop + Tproc + Tack + Tprop Tframe = time to transmit frame Tprop = propagation time Tproc = processing time at station Tack = time to transmit ack Assume Tproc andTack relatively small DataLink Layer
Error-Free Stop and Wait T ≈ Tframe + 2Tprop Throughput = 1/T = 1/(Tframe + 2Tprop) frames/sec Normalize by link data rate: 1/ Tframe frames/sec S = 1/(Tframe + 2Tprop) = Tframe = 1 1/ Tframe Tframe + 2Tprop 1 + 2a where a = Tprop / Tframe DataLink Layer
Figure 11.8 DataLink Layer
Stop-and-Wait ARQ with Errors P = probability a single frame is in error Nx = 1 1 - P = average number of times each frame must be transmitted due to errors S = 1 = 1 - P Nx (1 + 2a) (1 + 2a) DataLink Layer
The Parameter a a = propagation time = d/V = Rd transmission time L/R VL where d = distance between stations V = velocity of signal propagation L = length of frame in bits R = data rate on link in bits per sec DataLink Layer
Values of α DataLink Layer
Figure 11.9 DataLink Layer
Error-Free Sliding Window ARQ • Case 1: W ≥ 2a + 1 Ack for frame 1 reaches A before A has exhausted its window • Case 2: W < 2a +1 A exhausts its window at t = W and cannot send additional frames until t = 2a + 1 DataLink Layer
Figure 11.10 DataLink Layer
Normalized Throughput 1 W ≥ 2a + 1 S = W W < 2a +1 2a + 1 DataLink Layer
Selective Reject ARQ 1 - P W ≥ 2a + 1 S = W(1 - P) W < 2a +1 2a + 1 DataLink Layer
Go-Back-N ARQ 1 - P W ≥ 2a + 1 S = 1 + 2aP W(1 - P) W < 2a +1 (2a + 1)(1 – P + WP) DataLink Layer
Figure 11.11 DataLink Layer
Figure 11.12 DataLink Layer
Figure 11.13 DataLink Layer