Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3: The Datalink Layer CS 455/555. Topics to be covered Design Issues Error detection and correction Elementary datalink protocols Sliding window.

Similar presentations


Presentation on theme: "Chapter 3: The Datalink Layer CS 455/555. Topics to be covered Design Issues Error detection and correction Elementary datalink protocols Sliding window."— Presentation transcript:

1 Chapter 3: The Datalink Layer CS 455/555

2 Topics to be covered Design Issues Error detection and correction Elementary datalink protocols Sliding window protocols Example datalink protocols SLIP, PPP, DL in ATM

3 Design Issues Functions: Provide a well-defined interface to the network layer; determining the frame boundaries in the bit stream delivered by physical layer; dealing with transmission errors; regulating the flows (flow control) Services provided: Unacknowledged connectionless service, acknowledged connectionless service; acknowledged connection- oriented service; Framing: How can different frames be separated in the stream of bits received from the physical layer? Certainly, it is not wise to assume synchronized clocks between the two datalink layers (I.e., sender and receiver). Methods of separation: (1) Character count (2) Starting and ending characters (3) Starting and ending flags (sequence of bits) (4) Physical layer (5) A combination of the techniuqes

4 Design Issues (Contd.) Error Control: Sequence numbers, timers, acknowledgements, retransmissions Flow control: Rules to throttle a sender from sending at a rate higher than what the receiver can receive.

5 Error Detection and Correction Error-detection and error-correction codes Codeword: data+check bits Hamming distance: The number of bits by which two code words differ (e.g., 1101 and 1011 have a H-distance of 2). For 1101 to become 1011, 2 single-bit errors would have to occur. Suppose we use a special coding in which only 01 and 10 are recognized as legal where 01 represents data “0”, and 10 means data “1”. Clearly, in this coding, the patterns 00 and 11 are illegal. In addition, the distance between 01 and 10 is 2. So the Hamming distance for the coding is 2 (this is the minimum hamming distance between any two legal codes).

6 Error Detection and Correction (Contd) “To detect d errors, a coding with a hamming distance of d+1 is needed.” So, the earlier 2-bit coding can detect 1 error. Is it true? Suppose we send 01 and it becomes either 11 or 00, then the receiver knows that these are illegal codes. So it can detect them. What if there are two bit errors in “01”? Then it becomes “10” which cannot be detected.

7 Error Detection and Correction (Contd) “To correct d errors, we need a coding with 2d+1 distance.” So the earlier example, cannot correct any errors? Suppose “01” becomes “00” can this be corrected? No. Because it could have been a “01” or a “10”. Suppose we use a 3-bit coding where only “000” and “111” are legal codes. Thus, the distance of this code is 3. How many bit errors can this detect? 2. How many bit errors can this correct? 1. Example: Suppose “000” becomes “010”, since the distance between 010 and 000 is 1 while between 010 and 111 is 2. So it can correct 010 as 000. Parity bit: An example coding where 1 extra bit is generated to detect errors. This has a distance of 2 and hence can detect single-bit errors. Odd-parity: The number of 1’s in any legal code word are always odd. Even-parity: The number of 1’s in any legal code word are always even. Example: If 11011001 is a legal 8-bit code, is is odd or even parity? How about 11000101??

8 Error Detection and Correction (Contd) Error-detecting codes: Generation and detection: Use of Polynomial codes or Cyclic redundancy code or CRC code: A generator polynomial G(x) is known to both the sender and the receiver. Both the high-end and low-end bits of the polynomial must be 1. Ex: G(x) = x 4 +x 2 +1. This is represented as 10101 representing the coefficients of each of the exponent terms. Given a data frame of m bits and a generator of r bits, then the message sent will have m+r-1 bits where r-1 bits are extra bits generated and appended to the data frame. How to generate the r-1 bits to be appended?

9 Error Detection and Correction (Contd) Procedure for generating the code bits: Step 1: Append r-1 0’s to the given data frame. (r-1 is the degree of the generator polynomial) Step 2: Using modulo 2 division, divide the data bit stream from step 1 by the generator polynomial. Step 3: The remainder is the checksum to be appended to the original message which is then transmitted. Procedure for error-detection: The receiver divides the received bit stream by the generator polynomial using Modulo 2 division. If the remainder is 0, then there no errors are detected.

10 Error Detection and Correction (Contd) Example: Given an 8-bit word 11001100, generate checksum using the generator polynomial of 10101.

11 Error Detection and Correction (Contd) What bit pattern is transmitted? 110011001100 What happens at the receiver end? Receiver divides (Modulo 2 division) 110011001100 by the generator polynomial 10101. If the remainder is 0, then there is no detected error.

12 Elementary Data Link Protocols Unrestricted Simplex Protocol: Assume (I) Negligible processing time (ii) Unrestricted buffering (iii) No errors in the channel (Fig 3.9) A Simplex Stop-and-Wait Protocol: Relax the assumption of infinite buffers and negligible processing time: Sender sends a frame and waits until it gets an ACK before sending the next one.

13 Elementary Data Link Protocols (Contd.) A Simplex Protocol for a Noisy Channel: Here, a data frame could be in error when received. A receiver simply discards frames in error. The sender sets a timer, and when it times out, resends the same frame. In case, the original Ack was lost, a retransmission occurs. To avoid the problem of duplicate frames being delivered to the network layer at the receiver, a 1-bit sequence number is now introduced.

14 Elementary Data Link Protocols (Contd.) ARQ (Automatic Repeat Request) or PAR (Positive Acknowledgement with Retransmission): The last simplex protocol with 1-bit sequence number is an example of this type where the sender does waits for a +ve ACK before sending the next.

15 Sliding Window Protocols Duplex, more than one frame sent in each direction Piggybacking: ACK for the other station is piggybacked on the data frame being sent to it. Each outbound frame contains a sequence number, ranging from 0 to up to a maximum of 2 n -1 where n denotes the number of bits used for the sequence number field. If 3 bits are used, then the seq# is from 0 to 7.

16 Sliding Window Protocols (Contd.) Sender maintains a “sending window” and receiver maintains a “receiving window.” Sending window indicates frames sent but no ACK received yet At the sender, whenever a new packet is received from the NW-layer, it is assigned a sequence number which is outside the sending window. The upper edge of the sending window is then shifted up to include it. Similarly, when an ACK is received for the frame at the lower end of the sending window, the lower end is moved up. Receiving window indicates frames that are permitted to be accepted at the receiver. A frame falling outside the window is discarded. When a frame whose seq# equal to the lower edge of the window is received, it is delivered to the network layer and the window is rotated up by one unit.

17 Sliding Window Protocols (Contd.) A One-bit sliding window protocol: Here, only 1-bit is used for the sequence number. So it acts like the stop-and-wait protocol. Go back n Protocol: Let us assume sender window size n > 1 and receiver window size = 1. While sender may send multiple frames before receiving an ACK, the receiver only receives the next expected one and send ACK for that one. So when a frame that is ahead of what is expected arrives, the receiver simply discards it. Similarly, when a sender timeout, it retransmits all unacknowledged frames (not just the one that timed out). It can waste a lot of bandwidth. Example of Go back n: Suppose a sender has frames 2,3,…,7 outstanding. If frames 2 and 3 were in error, but 4 was received correctly at the receiver. Since it was expecting 2 and not 4, the receiver simply discards 4 and all subsequent ones. When the sender times out on 2, it resends 2,3,…7, which are still unacknowledged.

18 Go-back-N: Example Assume 3-bit sequence number 1.Station A sends frames 0..7. 2.A piggybacked ACK for frame 7 eventually comes to A. 3.Station A sends another eight frames 0..7. 4.Another piggybacked ACK for frame 7 comes to A. 5.Is the new ACK for the old set or the new set of 7? 6.Solution: Window-size = max_seq_number

19 Sliding Window Protocols (Contd.) Selective repeat: To reduce the number of retransmissions, here window size of receiver > 1. Suppose the receiver window size is 5. If, as in previous example, frames 2 and 3 are lost, but 4,5,6,7 are received correctly, then the receiver would store 4,5, and 6 (since it expects 2 and 3, it reserves 2 buffers for them) and discards 7. The trade-off here is between network bandwidth and buffer space at the datalink layer.

20 Sliding Window Protocols (Contd.) Go back n: Given that n-bit sequence numbers are used, what is the maximum window size at the sender? Answer: 2 n -1, which is the maximum sequence number. That is, if we use 3-bit seq# (0,1,…,7) then, the sender’s window can at most be 7. In other words, while the allowed seq# range is 8, at most 7 frames can be outstanding for ACK at any time at the sender. It also needs multiple timers.

21 Sliding Window Protocols (Contd.) Selective Repeat Protocol: Both sender and receiver maintain a window of acceptable sequence numbers. Sender’s window size starts from 0 and grows until a predefined maximum window size ((MAX_SEQ+1)/2). The receiver’s window is always ((MAX_SEQ+1)/2).

22 Selective Repeat (example) Scenario: 3-bit sequence number: If the window size is MAX_SEQ_NUMBER? 1.Station A sends frames 0—6 to station B. 2.Station B receives all seven frames and cumulatively acknowledges through RR 7. 3.Because of a noise burst, RR 7 is lost. 4.A times out and retransmits frame 0. 5.B has already advanced its receive window to accept frames 7,0,1,2,3,4,5. Thus, it assumes that frame 7 has been lost and that this is a new frame 0 which it accepts. 6.Solution: Window size = (max_seq_number+1)/2

23 Sliding Window Protocols (Contd.) Performance Issues: Stop-and-wait Flow control: Time to receive one frame and receive an acknowledgement (T F ) = 2*Propagation time + Transmission time (per frame) + 2*Processing time+Transmission time (ACK) Utilization U = Transmission time (per frame)/ T F If ACK transmission time and processing time are assumed to be negligible, then U=Frame Trans. time/(2*propagation time + Frame Trans. Time) If a = Prop. Time/ Trans. Time (frame) U = 1/(2a+1)

24 Sliding Window Protocols (Contd.) With errors: P --- Prob. That a single frame is in error; N is the window size

25 Sliding Window Protocols (Contd.) Assume frame size = 1000 bytes Prob of error in a frame = 10 -2 Link length = 10 km Speed of propagation = 200 km/msec Speed of transmission = 1 Mbps Number of bits in sequence # = 3 Determine the utilization of the channel in the case of stop-and-wait, the Go-back-N, and selective reject protocols.

26 Transmission delay = 8000/10 6 = 8 msec Propagation delay = 10/200 = 0.1 msec a=0.1/8 = 0.0125 P=0.01 Stop-and-wait: U = (1-P)/(1+2a)=0.09/1.025=0.088 or 8.8% Go-back-N: N=2 3 -1=7; N>(1+2a); U = 0.99/(1.00025)= or 99% Selective repeat: N=2 2 = 4; N>(1+2a); U =0.99

27 Data Link Layer in ATM Transmission convergence sublayer (TC): Actually part of ATM Physical layer: Each cell has 5-byte header and 48-byte data 5-byte header: 4-byte (VC+control info)+1-byte checksum 1-byte checksum(called HEC) is computed only on the 4- byte header field and uses x 8 +x 2 +x+1 as the generating polynomial OAM cells: Operation and maintenance cells: used by ATM to exchange control information among the switches Idle cells: When using a synchronous transmission medium (physical layer), if ATM switch has nothing to send, it generates idle cells

28 Data Link Layer in ATM At the sending end, TC sublayer takes a sequence of cells, adds a HEC to each one, converts the result to a bit stream, and matches the bit stream to the speed of the underlying physical medium. At the receiving end, the TC layer takes the incoming bit stream, locates the cell boundaries, verifies the headers, discards invalid cells, processes OAM cells, and passes the data cells to the ATM layer.

29 Data Link Layer in ATM How does TC sublayer recognize cell boundaries in a bit stream? It uses the HEC. HUNT PRESYNCH SYNCH Bit-by-bit check Cell-by-cell check Correct HEC detected Incorrect HEC detected  Consecutive correct HECs  Consecutive incorrect HECs


Download ppt "Chapter 3: The Datalink Layer CS 455/555. Topics to be covered Design Issues Error detection and correction Elementary datalink protocols Sliding window."

Similar presentations


Ads by Google