1 / 59

CSC 335 Data Communications and Networking

CSC 335 Data Communications and Networking. Lecture 5: Error Detection, Error Correction, and Data Security Dr. Cheer-Sun Yang. Motivation. Error can occur during transmission. Signal can be distorted and cause sampling errors. Sender sends a 1101, receiver can receive 1001 .

savanna
Download Presentation

CSC 335 Data Communications and Networking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 335Data CommunicationsandNetworking Lecture 5: Error Detection, Error Correction, and Data Security Dr. Cheer-Sun Yang

  2. Motivation • Error can occur during transmission. • Signal can be distorted and cause sampling errors. • Sender sends a 1101, receiver can receive 1001. • How can a receiver be aware of that an error has occurred? • Can the position of a single bit error be identified? • The techniques are called error detection and single bit error correction.

  3. Transmission Errors • External electromagnetic signals - noise • Transmission errors - attenuation • Lost data – timing But, before we talk about errors, we have to understand how messages are actually organized and sent.

  4. Protocol Data Unit • Messages are transmitted in a unit called protocol data unit (PDU). • The data unit at data link layer is called a frame which is a block of data bits enclosing in a beginning and ending character. The beginning character is called the start of header (SOH) and the ending character is called the end of transmission (EOT) in our textbook.

  5. Data Frame In fact, the header contains a FLAG, the address, and some control information. There are also several kinds of frames: information, supervisory, and others. Each information frame is also identified by a sequence number.

  6. Data Frame • Advantages: If error occurs at the sender side, the receiver will never receive the ending character. When the sender sends the header again, the receiver can synchronize easily. • Disadvantages: • overhead • what if the data portion includes a character identical to either the header or the ending character?

  7. Bit Stuffing and Byte Stuffing • Ideally, the frame header or the ending character won’t occur in the data block. • But, it could happen. • Bit-oriented protocol uses bit stuffing to solve the problem.

  8. Bit Stuffing • Header = 01111110 • In any data character, if there are 6 continuous 1 bits, the transmitter inserts an extra 1 bit after the fifth 1 bit; the receiver will reverse the procedure.

  9. Byte Stuffing • If any data block contains a SOH, EOT, or ESC (escape), the transmitter also does the following: • SOH in data becomes ESC + X. • EOT in data becomes ESC + Y. • ESC in data becomes ESC + Z.

  10. Error Detection • The ability to detect when a transmission error has occurred is called error detection. • Additional bits should be added by the transmitter for detecting errors at the receiving side. • Parity Bit • Value of parity bit is such that character has even (even parity) or odd (odd parity) number of ones • Disadvantage: Even number of bit errors goes undetected

  11. Parity Checking Analysis • Single bit error can be detected by a single parity bit. • For example, the original data bits include 11010100, the parity (even) bit is then 0. • The data bits and the parity bit will be sent together as a unit to the receiver. • If there is an error at the second bit, the receiver receives 100101000. The total number of 1’s is not an even number. The receiver can claim that the message is incorrect.

  12. Parity Checking (cont’d) • Single bit error can be detected by a single parity bit. • However, if two bits are transmitted incorrectly, the parity checking may not detect them. • For example, data=1101, parity bit = 1; • If incorrect data= 1011, parity bit = 1; the receiver cannot tell that this message is incorrect.

  13. Any Problem? • Parity checking will detect any single-bit error. • Is there any glitch? • Yes. • What?

  14. Single-Bit Error • Suppose an error occurred because of a brief power surge or static electricity whose duration is a hundredth of a second. If the data rate is 64 Kbps, approximately 640 bits will be affected. • When many bits are damaged, we call this a burst error. • Single-bit parity checking is very likely to fail!!

  15. Single-Bit Error (cont’d) • In general, if an odd number of bits change, parity checking will detect the error. • If an even number of bits change, parity checking will not detect the error. • The error detection rate is 50% which is not acceptable for a communications network. • Does this mean that parity checking is useless? – Well, No! • It is the basis of more complex techniques. It is also useful when single-bit error could happen.

  16. Double-Bit Error Detection • How about using two parity bits – one checks for the bits in odd positions and another checks for bits in even positions? • It is better but still not good enough – Why? • A:_____________________________. (Exercise)

  17. Burst Error Detection • Perhaps we should take a look at how data bits are actually transmitted. • A block of data bits are transmitted in a unit called frame. We will talk about the concept of data frame more in next lecture. • Let’s assume that a frame looks like this for now.

  18. Data Frame with Parity Bits

  19. Rather than sending all bits from one frame together, we send them separately. Transmitting just one bit of information is not very efficient, however. If there are more frames to be sent together, we can send one bit from each frame together with the parity bit of the new data frames. Fig 4.3 illustrates this principle.

  20. Instead of sending 10 5-bit frames with a parity bit, we send each column (6 10-bit frames). Now, suppose a burst error occurs and interferes with one transmission. At most, one bit from each original data frame is actually changed, and the parity check will detect them. How successful is this approach?

  21. The only way a burst error affecting two columns can go undetected is when either two bits or no bits are actually changed in each (old) frame. What is the probability that this error can occur and will not be detected? Suppose column i and j were affected. Suppose that the bits from column i are affected randomly. Now consider any bit from column j, it is either correct or it is incorrect. Therefore there is a ½ chance that an error occurs to two bits in the same row.

  22. If there are n bits in a column, there is a probability of (1/2)n that either two or no bits are changed in each row and the error goes undetected. If n=20, the probability that the error will not be detected = 1/1048576.

  23. Cyclic Redundancy Check • A major disadvantage of previous method is the cost of assembling and reassembling of the frames. Also, the error can only be detected after all frames are received. Then resending all frames is very costly. • Is there a way to send a frame and determine immediately whether there was an error? • Yes. CRC is more efficient although more difficult to understand.

  24. Bit String Representation The bit string 10010101110 is interpreted as

  25. CRC Method We assume all computations are done using modulo 2. • Given a bit string, append several 0s to the end of it (we will specify how many and why later) and call it B. Let B(x) be the polynomial corresponding to B. • Divide B(x) by some agreed-on polynomial G(x) (generator polynomial) and determine the remainder R(x).

  26. CRC Method (cont’d) • Define T(x) = B(x) – R(x). Later we will show that T(x)/G(x) generates a 0 remainder and that the subtraction can be done by replacing the previously appended 0 bits with the bit string corresponding to R(x). • Transmit T, the bit string corresponding to T(x). • Let T’ represent the bit stream that receiver receives and T’(x) the associated polynomial. The receiver divides T’(x) by G(x). If there is a 0 remainder the receiver concludes T=T’ and no error occurred. Otherwise, the receiver concludes an error occurred.

  27. Modulo 2 Addition • 0 + 0 = 0 • 0 + 1 = 1 • 1 + 0 = 1 • 1 + 1 = 0 (with no carry) • “Modulo 2” means “to take the remainder after dividing by 2.” • 2 mod 2 = 0

  28. Modulo 2 Subtraction • 0 – 0 = 0 • 0 – 1 = 1 (with no carry) (why?) • 1 – 0 = 1 • 1 – 1 = 0

  29. Exclusive OR and Modulo 2 Addition and Subtraction

  30. How CRC works? Suppose that we need to send the bit string 1101011, and the generator polynomial is G(x) = x4+x3 +1. Step 1: Append 0’s to the end of the string. The number of 0’s is the same as the degree of the the generator polynomial. Thus the string is (B=) 11010110000.

  31. How CRC works? (cont’d) Step 2: Divide B(x) by G(x). Find the corresponding bit representation of the remainder polynomial R(x). In our case 1010. Step 3: Find T(x) = B(x) – R(x). (Remember using modulo 2 subtraction). Transmit the string T. 11010110000 = B – 1010 = R -------------------------------- 11010111010 = T (FACT)

  32. How CRC works? (cont’d) Step 4: At the receiving side, receiver divides the string (received) by G(x). If the remainder is not 0, the string is incorrect.

  33. Summary of Cyclic Redundancy Check • For a block of k bits transmitter generates n bit sequence • Transmit k+n bits which is exactly divisible by some number • Receive divides frame by that number • If no remainder, assume no error • For math, see Section 4.3

  34. Hamming Code • Retransmission takes time and is costly if retransmission also fails. • Due to R. W. Hamming • Single-bit error correction : identifies the position of the error bit • Multiple-bit error detection : only detects that multiple-bit error has occurred

  35. General Concept • Insert some parity checking bit at in the bit string instead of at the end. • The parity bits check the parity in some specific location • If there is a single-bit error, the location can be identified by the combination of these parity bits.

  36. A Guessing Game • You can think of one number from 1 to 15 (Don’t tell me what it is.) • Is the number in one of the following? 1, 3, 5, 7, 9, 11, 13, 15 • Is the number in one of the following? 2, 3, 6, 7, 10, 11, 14, 15 • Is the number in one of the following? 4, 5, 6, 7, 12, 13, 14, 15 • Is the number in one of the following? 8, 9, 10, 11, 12, 13, 14,15

  37. An Example Data to send : m1 m2 m3 m4 m5 m6 m7 m8 Hamming Code p1 p2m1p3 m2 m3 m4 p4 m5 m6 m7 m8 P1 : even parity for positions 1,3,5,7,9,11 P2 : even parity for positions 2,3,6,7,10,11 P3 : even parity for positions 4,5,6,7,12 P4 : even parity for positions 8,9,10,11,12

  38. Position of Extra Bits • 20 = 1 the 1st position • 21 = 2 the 2nd position • 22 = 4 the 4th position • 23 = 8 the 8th position • 24 =16 the 16th position

More Related