Networks and Data Transmission : Error Detection
Please go to the original post. I copied this for my personal notes only.
REFER THIS LINK : https://www.computerscience.gcse.guru/theory/error-detection#:~:text=With%20an%20echo%20check%2C%20the,data%20will%20be%20transmitted%20again.
Error Detection
There is always the chance that data has been corrupted (changed in some way) during transmission.
This is true regardless of the distance of transmission.
To avoid having corrupted data it is really important that computers check for errors and correct them wherever possible.
There are several methods of error checking, with some being more effective than others.
Parity Check
An extra bit (parity bit) added to a string of binary code to ensure the number of 1-bits are either even or odd, depending upon the parity check system used.
Method
- The sending and receiving computers agree the protocol to be used (even or odd)
- The sending computer adds the correct parity bit to the binary data (either an extra 1 or 0)
- The sending computer sends the binary data, including the parity bit
- The receiving computer checks to make sure the overall parity of the data received is as agreed (an even or odd number of 1 bits)
- If the parity of the data is incorrect, the receiving computer will request that the data is transmitted again
Drawbacks of parity checks
- If two bits are transposed (change places) then the computer could be fooled into thinking the data is correct and not corrupted
- If two random bits change state then the system could also be fooled
Parity Block
This method of error checking is similar to a traditional parity check except the data is arranged in a virtual table with parity bits added to each row and column.
A single corrupted bit can be spotted at the intersection of a corrupted row and column.
Multiple corrupted bits would also flaw this system.
Checksum
A block of data is sent alongside a calculated checksum value.
The receiving computer also calculates what it believes should be the checksum.
The checksum values are then compared to see if an error has occurred during transmission.
Method
- The sending computer uses the block of data to be sent, and a predefined mathematical algorithm, to calculate a checksum value
- The sending computer sends the data, plus the checksum value
- The receiving computer uses the data it receives to also calculate what it believes should be the checksum, using the same mathematical algorithm
- The two checksum values are compared by the receiving computer
- Due to the nature of the algorithm, it is highly unlikely that corruption has occurred if the checksum values match
- If the checksum values don’t match, the receiving computer requests that the data is transmitted again
Check Digit
A check digit is the final digit in a code of numbers. It is calculated from all the other digits in the code. It’s purpose is to spot human errors on data entry.
Check digits are often found in barcodes, product codes or ISBN book numbers.
There are many different mathematical algorithms that can be used to calculate a check digit. Different industries will have their own preferred method.
Method
- The check digit is calculated and added to the barcode, packaging, product code etc at the point of manufacture
- A human types the long numerical code into a computer, e.g. the cashier will type the barcode number when a scanner fails or packaging is damaged
- The computer calculates what it believes should be the check digit, based on the numbers entered by the human
- The computer then compares it’s calculated check digit with the check digit typed in by the human (the last digit in the long code)
- If the two don’t match, then the human has made an error when typing in the numerical code, e.g. barcode number
- The human will be asked by the computer to re-enter the numerical code
Benefits
Good for spotting human errors such as:
- Incorrect digit entered
- Transposition error (two numbers change order)
- Omitted digit or extra digit
Automatic Repeat ReQuests (ARQ)
This form of error detection uses a system of acknowledgements and timeouts. Automatic Repeat ReQuests are often used to ensure reliable transmissions over an unreliable service.
Acknowledgements are messages sent from a receiving device back to the original sending device.
The acknowledgement can be negative or positive.
A positive acknowledgement means that the data was received and it passed an error check.
A negative acknowledgement means that the data was received but it cannot be used as it failed an error check. It needs to be sent again.
The timeout is a predetermined period of time that the sending device will wait to get some form of acknowledgement for the data it sent.
If no acknowledgement is received after the timeout, the device will sent the data again. This continues automatically until an acknowledgement is received, or the maximum number of re-sends occur.
Method
- The sending computer transmits a block of data
- The sending computer waits a period of time to see if the receiving computer acknowledges receipt of the data
- After no acknowledgement for a set period of time, a timeout occurs which triggers the data to be automatically resent by the sending computer
- This will continue until the receiving computer acknowledges the data has been received, or a max number of re-sends occurs
Echo Check
With an echo check, the receiving computer sends a copy of the data immediately back to the sending computer for comparison.
The sending computer compares the two sets of data to check if any errors occurred during the transmission process.
If an error has occurred, the data will be transmitted again.
Drawback of echo checks
- If the two sets of data are different you will have no way of knowing whether the error occurred when originally sent, or when it was sent back
- Echo checks require a lot of extra data to be transmitted
Ulasan