Data Communications and Networking

Slides:



Advertisements
Similar presentations
10. Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Advertisements

10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ERROR CORRECTION.
NETWORKING CONCEPTS. ERROR DETECTION Error occures when a bit is altered between transmission& reception ie. Binary 1 is transmitted but received is binary.
Chapter 10 Error Detection and Correction
ECOM 4314 Data Communications Fall September, 2010.
Error detection and correction
Error Detection and Correction
Error Detection and Correction Rizwan Rehman Centre for Computer Studies Dibrugarh University.
Hamming Code Rachel Ah Chuen. Basic concepts Networks must be able to transfer data from one device to another with complete accuracy. Data can be corrupted.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 PART III: DATA LINK LAYER ERROR DETECTION AND CORRECTION 7.1 Chapter 10.
Shashank Srivastava Motilal Nehru National Institute Of Technology, Allahabad Error Detection and Correction : Data Link Layer.
Lecture 10: Error Control Coding I Chapter 8 – Coding and Error Control From: Wireless Communications and Networks by William Stallings, Prentice Hall,
Copyright © NDSL, Chang Gung University. Permission required for reproduction or display. Chapter 10 Error Detection and Correction 長庚大學資訊工程學系 陳仁暉 副教授.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
British Computer Society
© 2009 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. 1 Communication Reliability Asst. Prof. Chaiporn Jaikaeo, Ph.D.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Data Link Layer: Error Detection and Correction
Chapter 10. Error Detection and Correction
The Data Link Layer Goal –As reliable as possible, efficient communication Point-to-Point –single connection –bits arrive in order sent Not necessarily.
Data Communications, Kwangwoon University10-1 Part 3 Data Link Layer Chapter 10 Error Detection and Correction Chapter 11 Data Link Control Chapter 12.
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
Cyclic Redundancy Check CRC Chapter CYCLIC CODES Cyclic codes are special linear block codes with one extra property. In a cyclic code, if a codeword.
Lecture 3-2: Coding and Error Control (Cont.) ECE
Unit 5 Lecture 2 Error Control Error Detection & Error Correction.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Detection and Correction
COMPUTER NETWORKS Ms. Mrinmoyee Mukherjee Assistant Professor St. Francis Institute of Technology, Mount Poinsur, S.V.P Road, Borivli (west), Mumbai
Error Detection and Correction
Computer Communication & Networks Lecture 9 Datalink Layer: Error Detection Waleed Ejaz
Lecture Focus: Data Communications and Networking  Data Link Layer  Error Control Lecture 19 CSCS 311.
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
1 © Unitec New Zealand CRC calculation and Hammings code.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Computer Communication & Networks Lecture 10 Datalink Layer: Error Correction Waleed Ejaz
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Block Coding Messages are made up of k bits. Transmitted packets have n bits, n > k: k-data bits and r-redundant bits. n = k + r.
10.1 Chapter 10 Error Detection and Correction Data can be corrupted during transmission. Some applications require that errors be detected and.
1 Kyung Hee University Position of the data-link layer.
Error Detection. Data can be corrupted during transmission. Some applications require that errors be detected and corrected. An error-detecting code can.
Chapter 10 Error Detection And Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Detection and Correction – Hamming Code
Data Link Layer. Data Link Layer Topics to Cover Error Detection and Correction Data Link Control and Protocols Multiple Access Local Area Networks Wireless.
Error Detection and Correction
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 PART III: DATA LINK LAYER ERROR DETECTION AND CORRECTION 7.1 Chapter 10.
Hamming Distance & Hamming Code
Transmission Errors Error Detection and Correction.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Part III: Data Link Layer Error Detection and Correction
Data Link Layer 1. 2 Single-bit error 3 Multiple-bit error 4.
ERROR DETECTION AND CORRECTION Chapter 8 Data Communications & Networking ERROR DETECTION AND CORRECTION Chapter 8 First Semester 2007/2008.
Powerpoint Templates Computer Communication & Network Week # 10.
Error Detection and Correction
Error Detection and Correction
Subject Name: COMPUTER NETWORKS-1
DATA COMMUNICATION AND NETWORKINGS
Part III Datalink Layer 10.
Chapter 10 Error Detection And Correction
Chapter 10 Error Detection And Correction
Welcome to the presentation. Linear Block Codes Almost all block codes used today belong to a subset called linear block codes. The exclusive OR of two.
Position of the data-link layer
Error Detection and Correction
Error Detection and Correction
Error Detection and Correction
Reliability and Channel Coding
Types of Errors Data transmission suffers unpredictable changes because of interference The interference can change the shape of the signal Single-bit.
Chapter 10 Error Detection and Correction
Presentation transcript:

Data Communications and Networking CSCS 311 Data Communications and Networking Lecture 20 Lecture Focus: Data Link Layer Error Control Error Correction 1

The correction of errors is more difficult than the detection. Error Correction We need to know the exact number of bits that are corrupted and more importantly, their location in the message. The number of the errors and the size of the message are important factors. If we need to correct one single error in an 8-bit data unit, we need to consider 8 possible error locations. If we need to correct two errors in a data unit of the same size, we need to consider 28 possibilities. Imagine the receiver's difficulty in finding 10 errors in a data unit of 1000 bits. 8! = 8 *7 * 6! ---- 2! * 6! The correction of errors is more difficult than the detection. 2

Error Correction Techniques Retransmission Forward Error Correction Burst Error Correction 3

Error Correction Error Correction Techniques Retransmission Forward Error Correction (FEC) In this process, the receiver tries to guess the message by using redundant bits. This is possible, if the number of errors is small. Retransmission A technique in which the receiver detects the occurrence of an error and asks the sender to resend the message. Resending is repeated until a message arrives that the receiver believes is error-free (usually, not all errors can be detected). 4

Error Correction Encoder and Decoder Encoder Decoder k bits Dataword Generator Checker Unreliable Transmission n bits Codeword Codeword n bits Receiver Sender 5

Error Correction Example: Let us add 3 redundant bits to the 2-bit dataword to make 5-bit codewords. Table below shows the datawords and codewords. Assume the dataword is 01. The sender consults the table (or uses an algorithm) to create the codeword 01011. The codeword is corrupted during transmission, and 01001 is received (error in the second bit from the right). First, the receiver finds that the received codeword is not in the table. This means an error has occurred. (Detection must come before correction.) The receiver, assuming that there is only 1 bit corrupted, uses the following strategy to guess the correct dataword. 01001 6

Error Correction Comparing the received codeword with the first codeword in the table (01001 versus 00000), the receiver decides that the first codeword is not the one that was sent because there are two different bits. By the same reasoning, the original codeword cannot be the third or fourth one in the table. The original codeword must be the second one in the table because this is the only one that differs from the received codeword by 1 bit. The receiver replaces 01001 with 01011 and consults the table to find the dataword 01. X 01001 X X 7

Error Correction Hamming Distance The Hamming distance between two words (of the same size) is the number of differences between the corresponding bits. We show the Hamming distance between two words x and y as d(x, y). The Hamming distance can easily be found if we apply the XOR operation (  ) on the two words and count the number of 1s in the result. Note that the Hamming distance is a value greater than zero. d(x, y) > 0 Example: The Hamming distance d(000, 011) is 2. 000  011 is 011 (two 1s). The Hamming distance d(10101, 11110) is 3. 10101  11110 is 01011 (three 1s). 8

Minimum Hamming Distance Error Correction Hamming Distance Minimum Hamming Distance The concept of the Hamming distance is the central point in dealing with error detection and correction codes. The measurement that is used for designing a code is the minimum Hamming distance. In a set of words, the minimum Hamming distance is the smallest Hamming distance between all possible pairs. We use dmin to define the minimum Hamming distance in a coding scheme. To find this value, we find the Hamming distances between all words and select the smallest one. 9

Minimum Hamming Distance Error Correction Hamming Distance Minimum Hamming Distance Example: Find the minimum Hamming distance of the coding scheme in below table. Solution: We first find all Hamming distances. d(000, 011) =2 d(000, 101) =2 d(000, 110) =2 d(011, 101) =2 d(011, 110) =2 d(101,110)=2 The dmin in this case is 2. 10

Minimum Hamming Distance Error Correction Hamming Distance Minimum Hamming Distance Example: Find the minimum Hamming distance of the coding scheme in below table. Solution: We first find all the Hamming distances. d(00000, 01011) = 3 d(01011, 10101) = 4 d(00000, 10101) = 3 d(01011, 11110) = 3 d(00000, 11110) = 4 d(10101, 11110) = 3 The dmin in this case is 3. 11

Minimum Hamming Distance Error Correction Hamming Distance Minimum Hamming Distance Three Parameters Any coding scheme needs to have at least three parameters: The codeword size n, The dataword size k, and The minimum Hamming distance dmin. A coding scheme C is written as C(n, k) with a separate expression for dmin. We can call our first coding scheme C(3, 2) with dmin =2 and our second coding scheme C(5, 2) with dmin = 3. 12

Error Correction Hamming Distance Hamming Distance and Error When a codeword is corrupted during transmission, the Hamming distance between the sent and received codewords is the number of bits affected by the error. In other words, the Hamming distance between the received codeword and the sent codeword is the number of bits that are corrupted during transmission. If the codeword 00000 is sent and 01101 is received, 3 bits are in error and the Hamming distance between the two is d(00000, 01101) =3. 13

Error Correction Hamming Distance Minimum Distance for Error Detection If s errors occur during transmission, the Hamming distance between the sent codeword and received codeword is s. If our code is to detect up to s errors, the minimum distance between the valid codes must be s + 1, so that the received codeword does not match a valid codeword. In other words, if the minimum distance between all valid codewords is s + 1, the received codeword can’t be erroneously mistaken for another codeword. The distances are not enough (s + 1) for the receiver to accept it as valid. The error will be detected. 14

Error Correction Hamming Distance Minimum Distance for Error Detection Example: The minimum Hamming distance for (table below) is 2. This code guarantees detection of only a single error. For example, if the third codeword (101) is sent and one error occurs, the received codeword does not match any valid codeword. If two errors occur, however, the received codeword may match a valid codeword and the errors are not detected. 15

Error Correction Hamming Distance Minimum Distance for Error Detection Example: The minimum Hamming distance for (table below) is 3. This code can detect up to two errors. We see that when any of the valid codewords is sent, two errors create a codeword which is not in the table of valid codewords. The receiver cannot be fooled. However, some combinations of three errors change a valid codeword to another valid codeword. The receiver accepts the received codeword and the errors are undetected. 16

Error Correction Hamming Distance Minimum Distance for Error Correction dmin = 2*t + 1 where t is the number of errors that can be corrected. If the minimum Hamming distance is 3, code can detect up to two errors and correct up to 1 error. 17

Error Correction Hamming Code A category of error-correcting codes. These codes were originally designed with dmin = 3, which means that they can detect up to two errors or correct one single error. Although there are some Hamming codes that can correct more than one error, our discussion focuses on the single-bit error-correcting code. First let us find the relationship between n and k in a Hamming code. We need to choose an integer m >= 3. (why?) The values of n and k are calculated from m as n = 2m – 1 and k = n - m. The number of check bits r = m. 18

Error Correction Hamming Code For example, if m =3, then n = 7 and k = 4. This is a Hamming code C(7, 4) with dmin =3. Table below shows the datawords and codewords for this code. 19

Error Correction Hamming Code a3 a2 a1 a0 a3 a2 a1 a0 a3 a2 a1 a0 r2 The structure of the encoder and decoder for a Hamming code Encoder Decoder Dataword Dataword a3 a2 a1 a0 a3 a2 a1 a0 Syndrome Correction Logic s2 s1 s0 Generator Checker a3 a2 a1 a0 r2 r1 r0 b3 b2 b1 b0 q2 q1 q0 Unreliable Transmission Codeword Codeword 20

r0 = a2 + a1 + a0 (Modulo-2) r1 = a3 + a2 + a1 (Modulo-2) Error Correction Hamming Code The structure of the encoder and decoder for a Hamming code A copy of a 4-bit dataword is fed into the generator that creates three parity checks r0, r1 and r2 as shown below: r0 = a2 + a1 + a0 (Modulo-2) r1 = a3 + a2 + a1 (Modulo-2) r2 = a1 + a0 + a3 (Modulo-2) Each of the parity-check bits handles 3 out of the 4 bits of the dataword. The total number of 1s in each 4-bit combination (3 dataword bits and 1 parity bit) must be even. 21

s0 = b2 + b1 + b0 + q0 (Modulo-2) s1 = b3 + b2 + b1 + q1 (Modulo-2) Error Correction Hamming Code The structure of the encoder and decoder for a Hamming code The checker in the decoder creates a 3-bit syndrome (s2s1s0) in which each bit is the parity check for 4 out of the 7 bits in the received codeword: s0 = b2 + b1 + b0 + q0 (Modulo-2) s1 = b3 + b2 + b1 + q1 (Modulo-2) s2 = b1 + b0 + b3 + q2 (Modulo-2) The 3-bit syndrome creates eight different bit patterns (000 to 111) that can represent eight different conditions. These conditions define a lack of error or an error in 1 of the 7 bits of the received codeword, as shown in below table. 22

Error Correction s0 = b2 + b1 + b0 + q0 s1 = b3 + b2 + b1 + q1 Hamming Code The structure of the encoder and decoder for a Hamming code The syndrome values in above table are based on the syndrome bit calculations. For example, if q0 is in error, s0 is the only bit affected; the syndrome, therefore, is 001. If b2 is in error, s0 and s1 are the bits affected; the syndrome, therefore is 011. If b1 is in error, all 3 syndrome bits are affected and the syndrome is 111. s0 = b2 + b1 + b0 + q0 s1 = b3 + b2 + b1 + q1 s2 = b1 + b0 + b3 + q2 23

Error Correction a0 = 0 a1 = 0 a2 = 1 a3 = 0 Hamming Code Example The dataword 0100 is to be sent. a0 = 0 a1 = 0 a2 = 1 a3 = 0 r0 = a2 + a1 + a0 = 0+0+1 = 1 r1 = a3 + a2 + a1 = 0+1+0 = 1 r2 = a1 + a0 + a3 = 0+0+0 = 0 So, the dataword 0100 becomes the codeword 0 1 0 0 0 1 1. The codeword 01 00011 is received. The syndrome is: s0 = b2 + b1 + b0 + q0 = 1 + 0 + 0 + 1 = 0 s1 = b3 + b2 + b1 + q1 = 0 + 1 + 0 + 1 = 0 s2 = b1 + b0 + b3 + q2 = 0 + 0 + 0 + 0 = 0 s2 s1 s0 = 0 0 0 As the syndrome is 000 (no error), the final dataword is 0100. b3b2b1b0q2q1q0 24

Error Correction a0 = 0 a1 = 1 a2 = 1 a3 = 1 Hamming Code Example The dataword 0111 is to be sent. a0 = 0 a1 = 1 a2 = 1 a3 = 1 r0 = a2 + a1 + a0 = 1+1+1 = 1 r1 = a3 + a2 + a1 = 0+1+1 = 0 r2 = a1 + a0 + a3 = 1+1+0 = 0 So, the dataword 0111 becomes the codeword 0 1 1 1 0 0 1. The codeword 0011001 is received. The syndrome is: s0 = b2 + b1 + b0 + q0 = 0 + 1 + 1 + 1 = 1 s1 = b3 + b2 + b1 + q1 = 0 + 0 + 1 + 0 = 1 s2 = b1 + b0 + b3 + q2 = 1 + 1 + 0 + 0 = 0 s2 s1 s0 = 0 1 1 Syndrome is 011. According to the below table, b2 is in error. After flipping b2 (changing the 1 to 0), the final dataword is 0111. b3b2b1b0q2q1q0 25

Error Correction Hamming Code The structure of the encoder and decoder for a Hamming code Example The dataword 1101 becomes the codeword 1101000. The codeword 0001000 is received (two errors). The syndrome is 101, which means that b0 is in error. After flipping b0, we get 0000, the wrong dataword. This shows that our code cannot correct two errors. 26

Number of redundancy bits r = m Error Correction Hamming Code Data and redundancy bits Number of data bits k Number of redundancy bits r = m Total bits n = k + r = k + m 1 2 3 5 6 4 7 9 10 11 m = the number of check bits ( m >= 3) n = 2m – 1 k = n - m. 27

Error Correction Hamming Code Data and redundancy bits Positions of redundancy bits in Hamming code 28

Redundancy bits calculation Error Correction Hamming Code Redundancy bits calculation 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 29

Example of redundancy bit calculation Error Correction Hamming Code Example of redundancy bit calculation 30

Error detection using Hamming code Error Correction Hamming Code Error detection using Hamming code 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 31