Presentation is loading. Please wait.

Presentation is loading. Please wait.

McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz PART III.

Similar presentations


Presentation on theme: "McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz PART III."— Presentation transcript:

1

2 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz PART III

3 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Position of the data-link layer - DLL

4 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Functions of the Data Link Layer 2 Provide service interface to the network layer must use the service provided by the physical layer 2 the receiving data link layer hand packets to the network layer in sequence is responsible for carrying a frame from one hop (computer or router) to the next hop. Unlike the network layer which has a global responsibility, the data link layer has a local responsibility. Its responsibility lies between two hops. the responsibility of the data link layer is to carry a frame through a LAN or WAN.

5 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Functions of the Data Link Layer 2 Packetizing The data link layer is responsible for moving data from one hop to the next. To get to the next hop, the data must pass through a LAN or a WAN, each of which has its own protocols. The packet coming from the upper layer must therefore be encapsulated in the appropriate packet defined by the data link layer of the underlying LAN or WAN. Different protocols have different names for the packet at the data link layer. Most LANs refer to the packet as a frame. The ATM WAN refers to a packet as a cell. Addressing DLL addresses are called physical addresses (or MAC addresses) and are used to find the address of the next hop in hop-to-hop delivery. The physical address used by a LAN is totally different from that used by a WAN. A LAN uses a next-hop address to carry a frame across the LAN; a WAN normally uses a virtual circuit address. Error Control Networks must be able to transfer data from one device to another with complete accuracy. if the # of bits received is <> than transmitted, layer 2 should detect it and, if necessary, correct it

6 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Functions of the Data Link Layer 2 Regulating data flow – Flow Control flow control is a set of procedures that tells the sender how much data it can transmit before it must wait for an acknowledgment from the receiver Flow control is a technique for assuring that a transmitting entity does not overwhelm a receiving entity with data. Flow control enables a receiver to regulate the flow of data from a sender so that the receiver’s buffers do not overflow.

7 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Functions of the Data Link Layer 2 Media Access Control When computers use a shared medium (cable or air), there must be a method to control access to the medium at any moment. To prevent this conflict or collision on a network, there is a need for a Medium Access Control (MAC) method.

8 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Data link layer duties

9 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Functions of the Data Link Layer (2) Relationship between packets and frames. The layer 2 protocol unit (PU) is called a frame A frame has a header, a payload and a trailer. The payload is received from layer 3. The header contains control information (e.g. for error recovery) The trailer contains some redundancy to detect (and sometimes correct) transmission errors

10 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Services Provided to Network Layer (a) Virtual communication. (b) Actual communication. The frames are passed to the physical layer that will transmit them on the physical medium in a suitable manner (coding). Some delay could be introduced between frames to allow for a proper decoding at the receiver, but short delays may vary (and possibly disappear) due to intermediate equipments long delays increase the overhead

11 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Services Provided to Network Layer Placement of the data link protocol.

12 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Role of the Data Link Layer To provide services to the network layer (3) by enhancing the services provided by the physical layer (1). Several types of services: - reliable service on a link (no error, no loss, no reordering) - acknowledged connection-oriented service error detection and recovery at the data link layer flow control to protect buffers at receiver the data link layer guarantees that each frame sent over the connection is indeed received - unreliable service on a link - acknowledged connectionless oriented service - unacknowledged connectionless oriented service error detection done at the data link layer recovery done at higher layers

13 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Phases of a reliable protocol When a physical link is available (equipment are connected) (otherwise open it: role of layer 1),do: 1. Establish the data link connection (layer 2 processes are synchronized) 2. Transfer data 3. Release the connection Close the physical link (if it is not permanent and) if it is not needed any more.

14 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz LLC and MAC sublayers The Internet does not spell out specifications for LANs or WANs. The Internet accepts any LAN as a communications pathway for transferring its network layer packet. In 1985, the Computer Society of the IEEE sets standards to enable intercommunication between equipment from a variety of manufacturers. The IEEE has subdivided the DDL into two sublayers: 1.logical link control (LLC) and 2.media access control (MAC)

15 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz IEEE standards for LANs

16 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Chapters Chapter 10 Error Detection and Correction Chapter 11 Data Link Control and Protocols Chapter 12 Point-To-Point Access Chapter 13Multiple Access Chapter 14Local Area Networks Chapter 15 Wireless LANs Chapter 16 Connecting LANs Chapter 17 Cellular Telephone and Satellite Networks Chapter 18 Virtual Circuit Switching

17 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Chapter 10 Error Detection and Correction

18 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected. Note: 10.1 Types of Error

19 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.1 Types of Error 1.Single-Bit Error 2.Burst Error

20 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz In a single-bit error, only one bit in the data unit has changed. most likely to occur in a parallel transmission Note: 10.1 Types of Error ASCII STX (start of text)ASCII LF (line feed)

21 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz A burst error means that 2 or more bits in the data unit have changed. most likely to occur in a serial transmission 10.1 Types of Error

22 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.2 Detection 1.Redundancy 2.Parity Check 3.Cyclic Redundancy Check (CRC) 4.Checksum

23 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.3 Redundancy The goal of error checking is to correct errors, but we 1 st need to detect errors. Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination.

24 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.3 Redundancy The receiver puts the entire stream through a checking function. If the received bit stream passes the checking criteria, the data portion of the data unit is accepted and the redundant bits are discarded.

25 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.4 Detection methods In general – the more error detection bits added to some data, the better the error detection capability of the communication system

26 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Parity check - ERROR DETECTION The simplest error-detection scheme is to append a parity bit to the end of a block of data. The bit is selected so that the character has an even number of 1s. PARITY CHECK EVEN PARITY ODD PARITY The bit is selected so that the character has an odd number of 1s. 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 1

27 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.5 Even-parity concept In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity system).

28 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 1 Suppose the sender wants to send the word world p.861. In ASCII the five characters are coded as 1110111 1101111 1110010 1101100 1100100 The following shows the actual bits sent 11101110 11011110 11100100 11011000 11001001

29 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 2 Now suppose the word world in Example 1 is received by the receiver without being corrupted in transmission. 11101110 11011110 11100100 11011000 11001001 The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.

30 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 3 Now suppose the word world in Example 1 is corrupted during transmission. 11111110 11011110 11101100 11011000 11001001 The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission.

31 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Simple parity check can detect all single- bit errors.Simple parity check can detect all single- bit errors. It can detect burst errors only if the total # of errors in each data unit is odd (1, 3, 5, etc.)It can detect burst errors only if the total # of errors in each data unit is odd (1, 3, 5, etc.) So the parity check can detect only an odd number of errors; it cannot detect an even number of errors.So the parity check can detect only an odd number of errors; it cannot detect an even number of errors. Note: Performance

32 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.6 Two-dimensional parity In two-dimensional parity check, a block of bits is divided into rows and a redundant row of bits is added to the whole block.

33 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 4 Suppose the following block is sent: 10101001 00111001 11011101 11100111 10101010 However, it is hit by a burst noise of length 8, and some bits are corrupted. 10100011 10001001 11011101 11100111 10101010 When the receiver checks the parity bits, in the last unit all underlined bits do not follow the even-parity rule and the whole block is discarded. 10100011 10001001 11011101 11100111 10101010 Two-dimensional parity

34 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 2D parity check increases the likelihood of detecting burst errors. As we showed in Example 4, a redundancy of n bits can easily detect a burst error of n bits. A burst error of more than n bits is also detected by this method with a very high probability. But one pattern of errors that remains elusive. If 2 bits in one data unit are damaged and two bits in exactly the same positions in another data unit are also damaged, the checker will not detect an error. Consider, e.g., two data units: 11110000 and 11000011. If the first and last bits in each of them are changed, making the data units read 01110001 and 01000010, the errors cannot be detected by this method. Performance

35 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz ERROR DETECTION Cyclic Redundancy Check - CRC One of the most common, and one of the most powerful, error detecting codes is the cyclic redundancy check (CRC). The basic idea is to calculate some bit string (e.g. a polynomial code checksum using modulo 2 division) from the frame content and add it to the end of the frame

36 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Error Detecting Codes a polynomial code is called CRC (Cyclic Redundancy Check) is based on treating bit strings as representation of polynomials with coefficient of 0 and 1 only Such as a polynomial with k terms (degree k -1) is ranging from to x° ex. find the corresponding to 00110010 a polynomial G(x) x5 + x4 + x

37 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.10 A polynomial

38 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz addition and subtraction are identical 3 = 0 0 1 1 + 7 = 0 1 1 1 -------------- 0 1 0 0 (sum modulo 2) 3 = 0 0 1 1 - 7 = 0 1 1 1 -------------- 0 1 0 0 (subtract modulo 2) Both addition and subtraction are identical to exclusive OR

39 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.8 Binary division in a CRC generator

40 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Error-Detecting Codes Calculation of the polynomial code checksum.

41 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz CRC generator and checker The redundancy bits used by CRC are derived by dividing the data unit by a prede­termined divisor; the remainder is the CRC. a CRC must have exactly one less bit than the divisor, and appending it to the end of the data string must make the resulting bit sequence exactly divisible by the divisor.

42 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Error Detecting Codes The basic algorithm is to calculate some bit string (e.g. a polynomial code checksum using modulo 2 division) from the frame content and add it to the end of the frame in such a way that the polynomial represented by the checksummed frame is divisible by generator G(x) - divisor when the receiver gets the checksummed frame, it tries dividing it by G(x) if there is a remainder, there has been a transmission error otherwise transmitted frame T(x) is divisible (modulo 2) by G(x)

43 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Error Detecting Codes - not required Proof: In any division problem, if you diminish the dividend by the remainder, what is left is divisible by the divisor

44 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.9 Binary division in CRC checker

45 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Error Detecting Codes - not required Analyze the power of the method: Imagine the transmission error occurs, so that instead of the bit string for T(x) arriving, T(x) + E(x) each bit in E(x) corresponds to a bit that has been inverted if there are k 1 bits in E(x), k single-bit errors have occurred the receiver computes ( T(x) + E(x) ) / G (x) = E(x) / G (x) but T(x) / G (x) = 0 conclusion: those errors that happen to correspond to polynomials containing G(x) as a factor will slip by other errors such that E(x) is not divisible by G(x) will be caught The choice of G(x) is thus very important.

46 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz A polynomial should be selected to have at least the following properties: It should not be divisible by x all burst errors of a length equal to the degree of the polynomial are detected It should be divisible by x + 1 all burst errors affecting an odd number of bits are detected Performance: CRC is a very effective error detection method. If the divisor is chosen according to the these rules, 1. CRC can detect all burst errors of length less <= the degree of the polynomial. 2. CRC can detect all burst errors that affect an odd number of bits. 3. CRC can detect, with a very high probability, burst errors of length > the degree of the polynomial. Polynomials

47 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 5 It is obvious that we cannot choose x (binary 10) or x 2 + x (binary 110) as the polynomial because both are divisible by x. However, we can choose x + 1 (binary 11) because it is not divisible by x, but is divisible by x + 1. We can also choose x 2 + 1 (binary 101) because it is divisible by x + 1 (binary division). Polynomials

48 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 6 The CRC-12 x 12 + x 11 + x 3 + x + 1 which has a degree of 12, 1.will detect all burst errors affecting an odd number of bits, 2.will detect all burst errors with a length <= 12, and 3.will detect, 99.97 percent of the time, burst errors with a length of 12 or more.

49 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Table 10.1 Standard polynomials NamePolynomialApplication CRC-8x 8 + x 2 + x + 1ATM header CRC-10x 10 + x 9 + x 5 + x 4 + x 2 + 1ATM AAL ITU-16x 16 + x 12 + x 5 + 1HDLC ITU-32 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 LANs

50 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.12 Checksum The sender follows these steps: 1.The unit is divided into k sections, each of n (usually 16) bits. 2.All sections are added using one’s complement to get the sum. 3.The sum is complemented and becomes the checksum. 4. The checksum is sent with the data. The receiver follows these steps: 1.The unit is divided into k sections, each of n (usually 16) bits. 2.All sections are added using one’s complement to get the sum. 3. The sum is complemented.. 4. If the result is zero, the data are accepted: otherwise, rejected.

51 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Checksum Proof: If the result is zero, the data are accepted: otherwise, rejected.

52 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 7 Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one’s complement 10101001 00111001 ------------ Sum 11100010 Checksum 00011101 The pattern sent is 10101001 00111001 00011101

53 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 8 Now suppose the receiver receives the pattern sent in Example 7 and there is no error. 10101001 00111001 00011101 When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 00111001 00011101 Sum11111111 Complement 00000000 means that the pattern is OK.

54 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Example 9 Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 00011101 When the receiver adds the three sections, it gets 1 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 0 1 Partial Sum 1 1 1 0 0 0 1 0 1 Carry 1 Sum1 1 0 0 0 1 1 0 Complement 0 0 1 1 1 0 0 1 the pattern is corrupted.

55 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz The checksum detects all errors involving an odd # of bits as well as most errors involving an even # of bits but anytime a bit inversion is balanced by an opposite bit inversion in the corresponding digit of another data section (segment), the error is invisiblePerformance

56 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.3 Correction 1.Retransmission the receiver can have the sender retransmit the entire data unit 2.Forward Error Correction 3.Burst Error Correction

57 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz To calculate the number of redundancy bits r required to correct a given number of data bits m, we must find a relationship between m and r. With m bits of data and r bits of redundancy added to them, the length of the resulting code is m + r. If the total number of bits in a transmittable unit is m + r, then r must be able to indicate at least m + r + 1 different states. Of these, one state means no error, and m + r states indicate the location of an error in each of the m + r positions. So m + r + 1 states must be discoverable by r bits; and r bits can indicate different states. Therefore, Forward Error Correction

58 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Table 10.2 Data and redundancy bits Number of data bits m Number of redundancy bits r Total bits m + r 1 23 2 35 3 36 4 37 5 49 6 410 7 411 Find the smallest r value that can satisfy

59 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Hamming code Add check bits to the output, in the power of 2 (bits 1, 2, 4, 8,…) Remaining bits are data bits For each data bit k find k = ∑ 3 = 2 + 1 6 = 4 + 2 11 = 8 + 2 + 1

60 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.15 Redundancy bits calculation

61 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.16 Example of redundancy bit calculation Calculate for each r bit the even parities for the corresponding combinations. The parity value for each combination is the value of the corresponding r bit.

62 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.17 Error detection using Hamming code 1. The receiver takes the transmission and recalculates 4 new parity bits, using the same sets of bits used by the sender + the relevant parity r bit for each set. 2. Then it assembles the new parity values into a binary number in order of r8,r4,r2,r1

63 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Performance Once the bit is identified, the receiver can reverse its value and correct the error. The beauty of the technique is that it can easily be implemented in hardware and the code is corrected before the receiver knows about it. Although the Hamming code cannot correct a burst error directly, it is possible to rearrange the data and then apply the Hamming code

64 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Overhead of error correction Error correction has a substantial overhead in some cases. Example: Transmission of 1 Mbit as 1000 frames of 1000 bits Bit error rate = 1/ 1,000,000 With Hamming error correcting code (can correct 1 bit per frame) Transmission of 1000 frames of (1000 data + 10 check) bits = 1010 Kbit, so 10 Kbit for checking per 1 Mbit data With a parity bit error detecting code - can detect 1 bit error per frame Transmission of 1000 frames of 1001 bits = 1001 Kbit Retransmission of one frame = 1 Kbit Total = 1002 Kbit so 2 Kbit for checking per 1 Mbit data Conclusion: If more bit errors should be corrected (resp. detected) per frame, the balance is even more favorable to error detection and retransmission.

65 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz 10.3 Burst error correction Instead of sending all the bits in a data unit together, we can organize N units in a column and then send the first column, then the second column, and so on. The bits that are corrupted by a burst error are shown in squares and so on. In this way, if a burst error of M bits occurs (M < N), then the error does not corrupt M bits of one single unit; Each corrupted bit belongs to one unit and is automatically corrected. The trick here is to let the burst error corrupt only 1 bit of each unit..

66 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz Other words sum modulo 2 operations give us the effect as: Have each check bit establish even parity over itself and the data bits whose binary number includes the check bit’s number: Check bit 1 covers bits 1, 3, 5, 7, 9, 11 Check bit 2 covers bits 2, 3, 6, 7, 10, 11 Check bit 4 covers bits 4, 5, 6, 7, 12 Check bit 8 covers bits 8, 9, 10, 11, 12 page not required but it is v. useful

67 McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz page is not required but it is v. useful When there is one error, the result gives the erroneous bit: ex: bit 4 was received as 0, so 3 = 0 0 1 1 7 = 0 1 1 1 -------------- 0 1 0 0 (sum modulo 2), so bit 4 should be corrected What happens if bit 7 was received as 0?


Download ppt "McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 expanded by Jozef Goetz PART III."

Similar presentations


Ads by Google