Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 3 The Data Link Layer A. S. Tanenbaum Computer Networks W. Stallings Data and Computer Communications 1 Hybrid Model a) The hybrid reference model to be used in this book. 2 Data Link Layer Design Issues • • • • • • Services Provided to the Network Layer Framing Physical addressing Error Control Flow Control Access control. 3 Services Provided to Network Layer • Unacknowledged connectionless service. No acknowledgement, no logical connection, used in very low error rate channel and real-time traffic. • Acknowledged connectionless service. each frame acknowledged, used in unreliable channel • Acknowledged connection-oriented service a connection established, frames are numbed.reliable transmission guaranteed. 4 Functions of the Data Link Layer 5 For the data link layer, break the bit stream up into discrete frames and computer the checksum for each frame (error control). Four methods are used to break the bit stream. 1.Character count. (rarely used) 2.Flag bytes with byte stuffing 3.Starting and ending flags, with bit stuffing. 4.Physical layer coding violations. 6 Framing (packetizing) A character stream. (a) Without errors. (b) With one error. 7 Framing (2) (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. 8 Framing (3) Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing. 9 Flow Control Ensuring the sending entity does not overwhelm the receiving entity Feedback-based flow control Rate-based flow control (network layer) 10 Stop and Wait Only one frame at a time can be in transit. 1. Source transmits frame 2. Destination receives frame and replies with acknowledgement (if it is correct, otherwise send NAK.) 3.Source waits for ACK before sending next frame 4.Destination can stop flow by not send ACK 5.Source can retransmit if got a NAK. 6.Works well for a few large frames 7.Inefficient line utilization for 11 small frames Sliding Window Protocols 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 12 Example Sliding Window 13 Sliding Window Protocols (2) Duplex communication: each station needs to maintain two windows Piggyback: num of frame and num of ack are included in one frame. Sliding-window flow control is more efficient than stop-and-wait flow control. 14 Error Control Detection and correction of errors • Lost frames: a frame failed to arrived to the other side. • Damaged frames: some bits are in error. Automatic repeat request – Error detection – Positive acknowledgment – Retransmission after timeout – Negative acknowledgement 15 Error Detection and Error Correction a) Additional bits added by transmitter for error detection and/or error correction code b) Error detection is more often used in protocol with ARQ. High code rate, high reliability. c) Error correction is used in specific situation. (no reverse channel) d) Hybrid ARQ: combination of error detection and correction. 16 Error control Scheme 17 Stop-and –wait ARQ 1. Source transmits single frame 2. Wait for ACK 3. If received frame damaged, discard it 4. Transmitter has timeout 5. If no ACK within timeout, retransmit 6. If ACK damaged, transmitter will not recognise it, Transmitter will retransmit 7. Receive gets two copies of frame 8. Use ACK0 and ACK1 18 9. Simple but Inefficient Go Back N a) b) c) d) 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 19 Selective Reject (retransmission) a) Only rejected frames are retransmitted b) Subsequent frames are accepted by the receiver and buffered c) Minimizes retransmission d) Receiver must maintain large enough buffer to reordering. e) More complex login in transmitter 20 Example Data Link Protocols • HDLC – High-Level Data Link Control • The Data Link Layer in the Internet 21 High-Level Data Link Control 22 Frame format for bit-oriented protocols. High-Level Data Link Control (2) 23 The Data Link Layer in the Internet PPP (Point-to-point protocol) handles error detection, supports multiple protocols, allows IP addresses to be negotiated at connection time. 24 PPP – Point to Point Protocol The PPP full frame format for unnumbered mode operation. 25 Performance of ARQ Stop-and-Wait Flow Control The total time to send the data as T = n(2tprop + tframe) The utilization, or efficiency, of the line is u n t frame n(2t prop t frame) It is useful to define the parameter a = tprop/tframe . Then 1 u 1 2a 26 Error-free sliding-window flow control 1 u W 1 2a W 1 2a W 1 2a where W is window size 27 Frames are generated at node A and sent to node C through node B. Determine the minimum transmission rate required between nodes B and C so that the buffers of node B are not flooded, based on the following: •The data rate between A and B is 100 kbps. •The propagation delay is 5 μs/km for both lines. •There are full-duplex lines between the nodes. •All data frames are 1000 bits long; ACK frames are separate frames of negligible length. •Between A and B, a sliding-window protocol with a window size of 3 is used. Between B and C, stop-and-wait is used. •There are no errors. 28