1  Theory of Computer Science / Data Transmission


Error checking
Think of the game 'Chinese Whispers' the message that the first person whispers has to be transmitted, through a group of people until it reaches its final destination. It is not very often that the message will reach its destination completely intact and unchanged... this is an error in transmission. Transmission errors can also occur when one digital device attempts to transmit data to another, this can have a huge impact on productivity and as such methods have been designed to spot and correct these errors.
What causes errors in transmission?
Checking for Errors
Parity Checks
When transferring data from one location to another, one method of error checking that can be used is the parity bit system.
The parity bit system involves first deciding whether odd or even parity will be used. This means that the number of ones and zeros in a string of bits will even or odd.
When sending data, one single bit is added to ensure that the data has an odd or even number of 1s or 0s.
The parity bit system involves first deciding whether odd or even parity will be used. This means that the number of ones and zeros in a string of bits will even or odd.
When sending data, one single bit is added to ensure that the data has an odd or even number of 1s or 0s.
Example:
If a computer system had decided to use odd parity, it means that the number of 1s and 0s must be off.
So if we take the binary number:
So if we take the binary number:
1 
1 
O 
1 
O 
O 
1 
The parity bit system means that we will now add another bit to the right side of the binary number. This bit is called a parity bit and it is used to set the number of 1s and 0s to either odd or even.
In this case we are using an odd system there for we need the parity bit to be 1:
In this case we are using an odd system there for we need the parity bit to be 1:
Parity Bit 

1 
1 
1 
O 
1 
O 
O 
1 
Now with the addition of our parity bit we can see that there are a total of 5 x 1s and 3 x 0s in the binary number, both of these are odd numbers so the odd parity criteria is met.
How parity bits work
Before data is transmitted, both parties agree to use either odd or even parity.
The parity bit is set by the sending party and checked by the receiver
If the number of bits do not match the even or odd system it is clear that there could have been an error.
The receiver notifies the sender that the parity check failed and asks for the data to be reset.
Warning
The parity check is not perfect, it will fail to detect an error in transmission if more than one bit is altered as the re still could be the correct (odd or even) parity, however the bits could be in the wrong order.
The parity check is not perfect, it will fail to detect an error in transmission if more than one bit is altered as the re still could be the correct (odd or even) parity, however the bits could be in the wrong order.
Check Digits
A check digit is an additional digit that is added to the end of a string of numbers. The check digit is calculated by processing each number in the string through an algorithm, the result is then simply added to the end.
After the string of numbers is transmitted or input to a system, the same algorithm will be followed on the numbers. If the algorithm produces the same number that is the check digit, you can safely assume that the data was transmitted / input correctly. If the check digits do not match, you know that an error has occurred.
After the string of numbers is transmitted or input to a system, the same algorithm will be followed on the numbers. If the algorithm produces the same number that is the check digit, you can safely assume that the data was transmitted / input correctly. If the check digits do not match, you know that an error has occurred.
Check digits are commonly used in barcodes, In the bar code below you can see that the check digit is the right most digit  3
The barcode check digit is calculated by following the Modulo 10 algorithm. This is explained using the below example.
Example:
For this example we will attempt to calculate the check digit for the bar code image above. If the check digit is correct we should produce the number 3.
As already mentioned, check digits are often calculated using the Modulo 10 algorithm. Here are the steps of the algorithm:
1. Starting from the left most number multiply each bar code digit by 1 and 3 alternating. in this example it would mean the following:
For this example we will attempt to calculate the check digit for the bar code image above. If the check digit is correct we should produce the number 3.
As already mentioned, check digits are often calculated using the Modulo 10 algorithm. Here are the steps of the algorithm:
1. Starting from the left most number multiply each bar code digit by 1 and 3 alternating. in this example it would mean the following:
2. The next step is to add every multiplication result, in this case the result is 47:
3. Now that we have this total we must divide it by 10 and take note of the remainder, in this case the remainder is 7
4. The final step is to take the remainder and subtract it from 10. In this case it produces the number 3:
The final result here is 3 which matches the original check digit therefore we can conclude that the data is correct.
Checksums
A check sum is very similar to a check digit, however instead of being used on a string of numbers e.g. a bar code, the check sum is calculated by processing all of the data through an algorithm and it produces a "hash" code that is more than one digit long.
2 very common check sum algorithms are MD5 and SHA1
Checksums are used for many things including downloading of software or the processing of credit card numbers.
How it works:
2 very common check sum algorithms are MD5 and SHA1
Checksums are used for many things including downloading of software or the processing of credit card numbers.
How it works:
 The first step is that all of the data in a file or program is processed through an algorithm. This algorithm will produce a checksum that could look like this "fSrfk12!£%sdfr$fs"
 The data / file is then sent to the recipient, the check sum is also sent to the recipient
 The recipient will run the received data / file through the same algorithm to produce a check sum.
 The recipient will now compare the checksum sent from the sender to the one that they have produced themselves. If they match it is safe to assume that the data is error free. If the checksums do not match a request should be sent to resend the data.
ARQ (Automatic Repeat Request)
ARQ is the 4th error checking method that we will look at. ARQ is simply a system that is set up between sender and recipient to ensure that both parties are aware of any errors that occurred during transmission and that the correct steps are taken to fix the errors.
How it works:
How it works:
 At the start of the transmission a timer is set e.g. 10 seconds
 Data is then sent
 If the data is received within 10 seconds, the recipient will send an acknowledgement to the sender and the transmission is complete
 If the timer reaches 10 seconds and no acknowledgement of recipt has been recieved, the sender will resend the data to the recipient