Presentation is loading. Please wait.

Presentation is loading. Please wait.

CEN 4500 Data Communications Instructor: S. Masoud Sadjadi sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link.

Similar presentations


Presentation on theme: "CEN 4500 Data Communications Instructor: S. Masoud Sadjadi sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link."— Presentation transcript:

1 CEN 4500 Data Communications Instructor: S. Masoud Sadjadi http://www.cs.fiu.edu/~sadjadi/Teaching/ sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link Layer

2 CEN 4500, S. Masoud Sadjadi2 Recap: Data Link Layer Data link layer is the second layer in the hierarchy of the hybrid reference model Is to transform a raw transmission facility into a line that appears free of undetected transmission errors.

3 CEN 4500, S. Masoud Sadjadi3 Recap: Data Link Layer We will study algorithms for achieving reliable, efficient communication between two adjacent machines at the data link layer. –Adjacent machines are two machines that are connected by a communication channel that acts conceptually like a wire (e.g., coaxial cable, telephone line, or point-to-point wireless channel) –A channel is called “wire-like” if the bits are delivered in exactly the same order in which they are sent. What makes this layer essential is the fact that –communication channels make errors occasionally, –they have only a finite data rate, and –there is a non-zero propagation delay

4 CEN 4500, S. Masoud Sadjadi4 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

5 CEN 4500, S. Masoud Sadjadi5 Data Link Layer Design Issues Functions of the Data Link Layer –Providing a well-defined service to the network layer –Dealing with transmission errors –Regulating the flow of data so that slow receivers are not swamped by fast senders Solution –Data link layer takes the packets from the network layer and encapsulates them into frames for transmission. –A frame contains header, payload (packet), and trailer. –Frame management is what data link layer is all about.

6 CEN 4500, S. Masoud Sadjadi6 Functions of the Data Link Layer Relationship between packets and frames.

7 CEN 4500, S. Masoud Sadjadi7 Services Provided to Network Layer The principle service is transferring data from the network layer on the source machine to the network layer on the destination machine. (a) Virtual communication. (b) Actual communication.

8 CEN 4500, S. Masoud Sadjadi8 Reasonable Service Possibilities Unacknowledged connectionless service –When error-rate is very low, so that the recovery is left to the higher layers –Also for real-time traffic, such as voice –Most LANs use this on the data link layer Acknowledged connectionless service –Useful over unreliable channels, such as wireless Acknowledged connection-oriented service –Each frame is numbered to guarantee exactly once and in-order delivery of frames –A reliable bit stream

9 CEN 4500, S. Masoud Sadjadi9 Services Provided to Network Layer Placement of the data link protocol.

10 CEN 4500, S. Masoud Sadjadi10 Framing Physical layer accepts a raw bit stream and attempt to deliver it to the destination. It is up to the data link layer to detect and, if necessary, correct errors. The usual approach is for data link layer to break the bit stream up into discrete frames and compute the checksum for each frame. Framing Methods 1.Character count: count can be garbled 2.Flag bytes with byte stuffing: starting and ending delimiters 3.Starting and ending flags, with bit stuffing 4.Physical layer coding violations

11 CEN 4500, S. Masoud Sadjadi11 Framing: Character Count A character stream. –(a) Without errors. –(b) With one error.

12 CEN 4500, S. Masoud Sadjadi12 Framing: Flag Bytes w/ Byte Stuffing What if the flag byte’s bit pattern happens occurs in the date? Insert a escape byte (ESC) (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.

13 CEN 4500, S. Masoud Sadjadi13 Framing: Bit Stuffing Each frame starts and ends with a special bit pattern, 01111110 (in fact, a flag byte). Whenever the sender’s data link layer encounters five consecutive 1s in the data, it automatically stuffs a 0 bit into the outgoing bit stream 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.

14 CEN 4500, S. Masoud Sadjadi14 Framing: Physical Layer Coding Violation This method is only applicable to networks in which the encoding on the physical medium contains some redundancy. For example, some LANs encode 1 bit of data by using 2 physical bits –A 1 bit is a high-low pair –A 0 bit is a low-high pair –So, every data bit has a transition in the middle: easy for the receiver to locate the bit boundaries. –High-high and low-low are not used for data!

15 CEN 4500, S. Masoud Sadjadi15 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

16 CEN 4500, S. Masoud Sadjadi16 Error Background Transmission errors will be with us for a while –The local loops are still twisted copper pairs –Wireless communication is becoming more common Error Property –As a result of the physical process that generates them, errors on some media (e.g., radio) tend to come in bursts rather than singly. A burst error does not imply that all the bits are wrong; it just implies that at least the first and last are wrong –If errors were independent, most block would contain errors –However, they are much harder to correct than are isolated errors

17 CEN 4500, S. Masoud Sadjadi17 Error Handling Error Detection –On channels that are highly reliable, such as fiber, it is cheaper to detect errors and retransmit data –Error-detecting codes add enough redundant information to detect errors. Error Correction –On channels such as wireless links that make many errors, retransmission does not make much sense –Error-correcting codes need to include enough redundant information not only to detect the error but also to correct it

18 CEN 4500, S. Masoud Sadjadi18 Error-Detecting Codes: CRC Cyclic Redundancy Check (CRC) –Also known as polynomial code –Based on treating bit strings as representations of polynomials with coefficients of 0 and 1 only –A k-bit frame is regarded as the coefficient list for a polynomial with k terms, ranging from x k-1 to x 0. –For example, 110001 represents x 5 + x 4 + x 0 –Polynomial arithmetic is done modulo 2 There are no carries for addition or borrows for subtractions, both are identical to exclusive OR

19 CEN 4500, S. Masoud Sadjadi19 CRC Calculation of the polynomial code checksum. The sender and receiver agree upon a generator polynomial, G(x), both of its high and low bits are 1 To compute the checksum for some frame with m bits, corresponding to the polynomial M(x), the frame must be longer than the generator polynomial We append a checksum to the end of the frame, so that the resulting polynomial is dividable by G(x)

20 CEN 4500, S. Masoud Sadjadi20 Error-Correcting Code: Hamming Code A frame consists of m data bits and r redundant, or check, bits. –n = m + r; called n-bit codeword. Hamming Distance –The number of bit positions in which two codewords differ –If two codewords are a Hamming distance d apart, it will require d single-bit errors to convert one into the other. –Given the algorithm to compute the check bits, that are 2 m legal codewords out of 2 n codewords –The Hamming distance of the complete code (the list of legal codewords) is the minimun distance of any two codewords in the list.

21 CEN 4500, S. Masoud Sadjadi21 Error-Correcting Code: Hamming Code To detect d errors –you need a distance d + 1 code –If you receive a frame with d error, it will have an illegal codeword To correct d errors –you need a distance 2d + 1 code –The closer legal codeword is the one to pick Example, Parity Bit –The number of 1s are either even or odd –A code with single parity has distance 2

22 CEN 4500, S. Masoud Sadjadi22 Error-Correcting Code: Hamming Code How many check bit do we need to be able to correct a 1 bit error? For each 2 m legal codewords, we need to have n illegal ones, so n + 1 codewords should be reserved 2 m (n + 1) < 2 n OR (m + r + 1) < 2 r Hamming code to correct burst errors.

23 CEN 4500, S. Masoud Sadjadi23 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

24 CEN 4500, S. Masoud Sadjadi24 Elementary Data Link Protocols An Unrestricted Simplex Protocol –Protocol 1 A Simplex Stop-and-Wait Protocol –Protocol 2 A Simplex Protocol for a Noisy Channel –Protocol 3 Try the simulator on your own and discuss it in your study group!

25 CEN 4500, S. Masoud Sadjadi25 Assumptions for the Protocols The physical, data link, and network layers are independent processes that communicate by passing messages back and forth. Machine A is trying to send a long message to machine B, using a reliable, connection-oriented service. –Later, we will consider the case where B will try to send a message to A simultaneously. A has an infinite supply of data ready to be sent to B. –In a realistic situation, the data link layer will not sit in a tight loop waiting for an event, but it will be implemented using interrupts Machines do not crash As far as the data link layer is concerned, the packet passed across the interface to data link is pure data.

26 CEN 4500, S. Masoud Sadjadi26 Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.

27 CEN 4500, S. Masoud Sadjadi27 Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.

28 CEN 4500, S. Masoud Sadjadi28 Unrestricted Simplex Protocol: Protocol 1

29 CEN 4500, S. Masoud Sadjadi29 Simplex Stop-and- Wait Protocol: Protocol 2

30 CEN 4500, S. Masoud Sadjadi30 A Simplex Protocol for a Noisy Channel: Protocol 3 A positive acknowledgement with retransmission protocol. Continued 

31 CEN 4500, S. Masoud Sadjadi31 A Simplex Protocol for a Noisy Channel : Protocol 3 (ctd.) A positive acknowledgement with retransmission protocol.

32 CEN 4500, S. Masoud Sadjadi32 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

33 CEN 4500, S. Masoud Sadjadi33 Sliding Window Protocols Need for both way transmission of data –Using two simplex channels: two expensive –Using one channel in both directions (intermixed), with temporarily delaying the ack (piggybacking) A One-Bit Sliding Window Protocol –Protocol 4 A Protocol Using Go Back N –Protocol 5 A Protocol Using Selective Repeat –Protocol 6

34 CEN 4500, S. Masoud Sadjadi34 Sliding Window Protocols (2) A sliding window of size 1, with a 3-bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received. On the sender side: the frames that are sent or can be sent (no ack yet). On the receiver side: the frames that it may accept (discards other frames).

35 CEN 4500, S. Masoud Sadjadi35 A One-Bit Sliding Window Protocol: Protocol 4 Continued 

36 CEN 4500, S. Masoud Sadjadi36 A One-Bit Sliding Window Protocol : Protocol 4 (ctd.)

37 CEN 4500, S. Masoud Sadjadi37 A One-Bit Sliding Window Protocol : Protocol 4 (2) Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case, if both sides starts sending simultaneously (similar situation can occur as a result of premature timeouts). The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.

38 CEN 4500, S. Masoud Sadjadi38 A Protocol Using Go Back N : Protocol 5 Pipelining and error recovery. Effect on an error when (a) Receiver’s window size is 1. (b) Receiver’s window size is large.

39 CEN 4500, S. Masoud Sadjadi39 Sliding Window Protocol Using Go Back N : Protocol 5 Continued 

40 CEN 4500, S. Masoud Sadjadi40 Sliding Window Protocol Using Go Back N: Protocol 5 Continued 

41 CEN 4500, S. Masoud Sadjadi41 Sliding Window Protocol Using Go Back N: Protocol 5 Continued 

42 CEN 4500, S. Masoud Sadjadi42 Sliding Window Protocol Using Go Back N : Protocol 5

43 CEN 4500, S. Masoud Sadjadi43 Sliding Window Protocol Using Go Back N: Protocol 5 Simulation of multiple timers in software.

44 CEN 4500, S. Masoud Sadjadi44 A Sliding Window Protocol Using Selective Repeat: Protocol 6 Continued 

45 CEN 4500, S. Masoud Sadjadi45 Continued  A Sliding Window Protocol Using Selective Repeat : Protocol 6 (2)

46 CEN 4500, S. Masoud Sadjadi46 A Sliding Window Protocol Using Selective Repeat : Protocol 6 (3) Continued 

47 CEN 4500, S. Masoud Sadjadi47 A Sliding Window Protocol Using Selective Repeat : Protocol 6 (4)

48 CEN 4500, S. Masoud Sadjadi48 A Sliding Window Protocol Using Selective Repeat : Protocol 6 (5) (a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not acknowledged.

49 CEN 4500, S. Masoud Sadjadi49 Problem with non-sequential receive Suppose that we have a 3-bit seq. number –The sender is permitted to send up to 7 frames before it is required to wait for an ACK –Initially, we have (a) –The sender transmits 0, 1, 2, 3, 4, 5, and 6 –The receiver accepts any frame between 0 to 6 (inclusive) –All seven frames arrive correctly, so the receiver acknowledges them and advances its window (b) –Suppose that all the ACKs are lost –The sender times out and retransmits frame 0 –The receiver accepts this frame as it is within 7, 0, …, 5 –The receiver sends a piggybacked ACK for frame 6, since 0, …, 6 have been received previously. –The sender is happy that all its transmission are through and advances its window, and send 7, 0, …, 5. –Receiver then sends from 7 and the old frame 0 to the network!!! –Therefore, the network gets an incorrect frame and the protocol fails!!

50 CEN 4500, S. Masoud Sadjadi50 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

51 CEN 4500, S. Masoud Sadjadi51 Protocol Verification Finite State Machined Models Petri Net Models

52 CEN 4500, S. Masoud Sadjadi52 Finite State Machined Models (a) State diagram for protocol 3. (b) Transmissions.

53 CEN 4500, S. Masoud Sadjadi53 Petri Net Models A Petri net with two places and two transitions.

54 CEN 4500, S. Masoud Sadjadi54 Petri Net Models (2) A Petri net model for protocol 3.

55 CEN 4500, S. Masoud Sadjadi55 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

56 CEN 4500, S. Masoud Sadjadi56 Example Data Link Protocols HDLC – High-Level Data Link Control The Data Link Layer in the Internet

57 CEN 4500, S. Masoud Sadjadi57 High-Level Data Link Control Frame format for bit-oriented protocols.

58 CEN 4500, S. Masoud Sadjadi58 High-Level Data Link Control (2) Control field of (a) An information frame. (b) A supervisory frame. (c) An unnumbered frame.

59 CEN 4500, S. Masoud Sadjadi59 The Data Link Layer in the Internet A home personal computer acting as an internet host.

60 CEN 4500, S. Masoud Sadjadi60 PPP – Point to Point Protocol The PPP full frame format for unnumbered mode operation.

61 CEN 4500, S. Masoud Sadjadi61 PPP – Point to Point Protocol (2) A simplified phase diagram for bring a line up and down.

62 CEN 4500, S. Masoud Sadjadi62 PPP – Point to Point Protocol (3) The LCP frame types.

63 CEN 4500, S. Masoud Sadjadi63 Agenda Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Protocol Verification Example Data Link Protocols Summary

64 CEN 4500, S. Masoud Sadjadi64 Summary Data Link Layer –The task of data link layer is to convert the raw bit stream offered by the physical layer into a stream of frames for use by the network layer. –Framing methods: character count, byte and bit stuffing. –It provides error control, flow control Protocols –Protocols 1 to 6 –Sliding window protocols –Protocol Verification: FSMs & Petri Nets –Examples: SDLC, HDLC, and PPP.


Download ppt "CEN 4500 Data Communications Instructor: S. Masoud Sadjadi sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link."

Similar presentations


Ads by Google