Chapter 6 Errors Error Detection and Error Control

  • Slides: 28
Download presentation
Chapter 6 Errors, Error Detection, and Error Control

Chapter 6 Errors, Error Detection, and Error Control

Introduction v All transmitted signals will contain some rate of error (>0%) v Popular

Introduction v All transmitted signals will contain some rate of error (>0%) v Popular error control methods include: Ø Parity bits (add a 1 or 0 to the end of each seven bits) Ø Longitudinal redundancy checking (LRC) Ø Polynomial checking 2

What’s an “error”? v Human errors: Ø Incorrect IP address assignment, or subnet mask,

What’s an “error”? v Human errors: Ø Incorrect IP address assignment, or subnet mask, etc. v Network errors: Ø Lost data Ø Corrupted data (received, but garbled) 3

Line Noise and Distortion Errors Source Likely cause Line outage Storm, accident White noise

Line Noise and Distortion Errors Source Likely cause Line outage Storm, accident White noise Movement of electrons Impulse noise Random spikes of power Cross-talk Guardbands, wires too close Echo Reflective feedback Jitter Timing irregularities Delay distortion Propagation speed Attenuation Wires too long 4

Error Prevention v To prevent errors from happening, several techniques may be applied: Ø

Error Prevention v To prevent errors from happening, several techniques may be applied: Ø Ø Ø Proper shielding of cables to reduce interference Telephone line conditioning or equalization Replacing older media and equipment with new, possibly digital components Proper use of digital repeaters and analog amplifiers Observe the stated capacities of the media 5

6

6

Error Detection Methods v The only way to do error detection and correction is

Error Detection Methods v The only way to do error detection and correction is to send extra data with each message v Two common error detection methods: Ø Parity checking ü ü Ø Simple parity Longitudinal parity Cyclic redundancy checksum (CRC) 7

Simple Parity v Add an additional bit to each byte in the message: Ø

Simple Parity v Add an additional bit to each byte in the message: Ø Even parity causes the sum of all bits (including the parity bit) to be even Ø Odd parity causes the sum of all bits to be odd 1 Even parity 0 1 0 1 0 0 Odd parity 8

Example Letter 7 -bit ASCII Parity bit D 1 0 1 0 0 1

Example Letter 7 -bit ASCII Parity bit D 1 0 1 0 0 1 A 1 0 0 0 1 1 T 1 0 1 0 0 0 A 1 0 0 0 1 1 9

Longitudinal Parity v Add block check character (BCC) to the end of the message:

Longitudinal Parity v Add block check character (BCC) to the end of the message: Ø Perform odd parity checking on the block of bits for each character in the message 0 1 0 1 0 0 1 1 1 0 1 BCC 0 0 1 1 1 10

Example Letter 7 -bit ASCII Parity bit D 1 0 1 0 0 1

Example Letter 7 -bit ASCII Parity bit D 1 0 1 0 0 1 A 1 0 0 0 1 1 T 1 0 1 0 0 0 A 1 0 0 0 1 1 BCC 1 1 0 1 1 11

Parity Checks v Both simple parity and longitudinal parity do not catch all errors

Parity Checks v Both simple parity and longitudinal parity do not catch all errors v Simple parity only catches odd numbers of bit errors v Longitudinal parity is better at catching errors Ø But requires too many check bits added to a block of data v We need a better error detection method Ø What about cyclic redundancy checksum? 12

Arithmetic Checksum v Used in TCP and IP on the Internet v Characters to

Arithmetic Checksum v Used in TCP and IP on the Internet v Characters to be transmitted are converted to numeric form and summed v Sum is placed in some form at the end of the transmission v Receiver performs same conversion and summing and compares new sum with sent sum v TCP and IP processes a little more complex but idea is the same 13

Polynomial Checking v Adds a character (or series of characters) to the end of

Polynomial Checking v Adds a character (or series of characters) to the end of the message based on a mathematical algorithm: Ø Checksum ü Sum the message values and divide by 255. The remainder is the checksum D A T A 68 65 84 65 Checksum 282 = 1 remainder 27 255 0 0 1 1 1 14

Cyclical redundancy check v CRC error detection method treats packet of data to be

Cyclical redundancy check v CRC error detection method treats packet of data to be transmitted as a large polynomial v Transmitter Ø Using polynomial arithmetic, divides polynomial by a given generating polynomial v Quotient is discarded Ø Remainder is “attached” to the end of message v Message (with the remainder) is transmitted to the receiver v Receiver divides the message polynomial plus the remainder (checksum) by same generating polynomial v If a remainder of zero results Ú no error during transmission v If a remainder not equal to zero results Úerror during transmission 15

Example: CRC 7 6 5 4 3 2 1 0 0 0 1 1

Example: CRC 7 6 5 4 3 2 1 0 0 0 1 1 1 Message polynomial x 5+x 4+x 2+x 1+x 0 x 5+x 4+x 2+x+1 Generating polynomial ATM CRC x 8 + x 2 + x + 1 CRC-16 x 16 + x 15 + x 2 + 1 16

17

17

Error Control v Once an error is detected, the receiver can: 1. Toss the

Error Control v Once an error is detected, the receiver can: 1. Toss the frame/packet v Some newer systems such as frame relay perform this type of error control 2. Return an error message to the transmitter v Stop-and-wait error control v Sliding window error control 3. Fix the error with no further help from the transmitter 18

Toss frame/packet v Seems like a strange way to control errors but some lower-layer

Toss frame/packet v Seems like a strange way to control errors but some lower-layer protocols such as frame relay perform this type of error control v For example, if frame relay detects an error, it simply tosses the frame v No message is returned v Frame relay assumes a higher protocol (such as TCP/IP) will detect the tossed frame and ask for retransmission 19

Return A Message v Once an error is detected, an error message is returned

Return A Message v Once an error is detected, an error message is returned to the transmitter v Two basic forms: Ø Ø Stop-and-wait error control Sliding window error control 20

Stop-and-wait Error Control v A transmitter sends a frame then stops and waits for

Stop-and-wait Error Control v A transmitter sends a frame then stops and waits for an acknowledgment v If a positive acknowledgment (ACK) is received, the next frame is sent v If a negative acknowledgment (NAK) is received, the same frame is transmitted again 21

Sliding Window Error Control v These techniques assume that multiple frames are in transmission

Sliding Window Error Control v These techniques assume that multiple frames are in transmission at one time v A sliding window protocol allows the transmitter to send a number of data packets at one time before receiving any acknowledgments Ø Depends on window size v When a receiver does acknowledge receipt, the returned ACK contains the number of the frame expected next v Older sliding window protocols numbered each frame or packet that was transmitted v More modern sliding window protocols number each byte within a frame 22

v Notice that an ACK is not always sent after each frame is received

v Notice that an ACK is not always sent after each frame is received Ø It is more efficient to wait for a few received frames before returning an ACK v How long should you wait until you return an ACK? 23

TCP/IP v Rule 1: If a receiver just received data and wants to send

TCP/IP v Rule 1: If a receiver just received data and wants to send its own data, piggyback an ACK along with that data v Rule 2: If a receiver has no data to return and has just ACKed the last packet, receiver waits 500 ms for another packet Ø If while waiting, another packet arrives, send the ACK immediately v Rule 3: If a receiver has no data to return and has just ACKed the last packet, receiver waits 500 ms Ø No packet, send ACK 24

Packet Lost v If a frame is lost, the following frame will be “out

Packet Lost v If a frame is lost, the following frame will be “out of sequence” Ø The receiver will hold the out of sequence bytes in a buffer and request the sender to retransmit the missing frame 25

ACK Lost v If an ACK is lost, the sender will wait for the

ACK Lost v If an ACK is lost, the sender will wait for the ACK to arrive and eventually time out Ø When the time-out occurs, the sender will resend the last frame 26

Correct the Error v For a receiver to correct the error with no further

Correct the Error v For a receiver to correct the error with no further help from the transmitter requires a large amount of redundant information to accompany the original data Ø This redundant information allows the receiver to determine the error and make corrections v This type of error control is often called forward error correction and involves codes called Hamming codes Ø Hamming codes additional check bits to a character ü These check bits perform parity checks on various bits 27

v For example, what if bit b 9 flips? Ø The c 8 check

v For example, what if bit b 9 flips? Ø The c 8 check bit checks bits b 12, b 11, b 10, b 9 and c 8 (01000) ü Ø The c 4 check bit checks bits b 12, b 7, b 6, b 5 and c 4 (00101) ü Ø This would not cause a parity error The c 1 check bit checks b 11, b 9, b 7, b 5, b 3 and c 1 (100011) ü Ø This would not cause a parity error (even number of 1 s) The c 2 check bit checks bits b 11, b 10, b 7, b 6, b 3 and c 2 (100111) ü Ø This would cause a parity error Writing the parity errors in sequence gives us 1001, which is binary for the value 9 ü Thus, the bit error occurred in the 9 th position 28