3. Error Control
Error control is both error detection and error correction.
It allows the receiver to inform the sender of any frames lost or damaged in
transmission and coordinates the retransmission of those frames by the sender.
Any time an error is detected in an exchange, specified frames are
retransmitted. This process is called automatic repeat request (ARQ).
• Types of Errors: Whenever bits flow from one point to another, they are subject
to unpredictable changes because of interference. This interference can change
the shape of the signal.
• There are two types of error
Single-Bit Error
Burst Error
4. Error Detection and Correction
• Single-Bit Error: The term single-bit error means that only 1 bit of a given
data unit (such as a byte, character, or packet) is changed from 1 to 0 or
from 0 to 1.
Burst Error: The term burst error means that 2 or more bits in the data
unit have changed from 1 to 0 or from 0 to 1.
Figure 7: Example of Single-bit error and Burst error.
5. Error-Correcting Codes – hamming Code
https://www.youtube.com/watch?v=aFNfjdFg5-o
A method that adds redundant bits to a data unit to detect and correct bit
errors.
So, one parity bit can tell us an error occurred
Multiple parity bits can also tell us where it occurred
6. Hamming Code - Example
Adding number of bits k to the original data
the k bits are added in places 20=1, 21=2, 22=4, 23=8, 124=16, ……
How to determine number of added bits (k)?
To achieve that we need to accomplish the following relation 2k-1>=n+k
Range of data bits Number of check bits
2-4 3
5-11 4
12-16 5
For example
Consider the original data n is 8 bits = 11000100 use hamming code to
perform error check for transmitted data?
Solution:
Because the original data is 8 bits then we will add 4 bits for hamming
code called parity code in positions 20,21,22,23
1 1 0 0 0 1 0 0
P1 P2 1 P4 1 0 0 P8 0 1 0 0
7. Hamming Code - Example
P1 P2 1 P4 1 0 0 P8 0 1 0 0
How to compute P1, P2, P4, and P8?
P1=XOR{1,1,0,0,0} (take one and leave one starting from the bit itself) (it equal 0
if number of 1’s is even otherwise it equal 1). So p1=0
P2= XOR{1,0,0,1,0} (take two and leave two starting from the bit itself). So p2=0.
P4=XOR{1,0,0,0} (take four and leave four starting from the bit itself). So p4=1.
P8=XOR{0,1,0,0} (take 8 and leave 8 starting from the bit itself). So p8=1.
SO, Hamming code is
0 0 1 1 1 0 0 1 0 1 0 0
8. Hamming Code - Example
To proof there is no error occurred
you need to compute the p1, p2, p4, and p8 at the receiver side
P1= XOR{0,1,1,0,0,0} = 0
P2= {0,1,0,0,1,0} = 0
P4= {1,1,0,0,0}=0
p8= XOR{1,0,1,0,0} = 0
Because all values at the receiver side = 0 then the data is received
correctly.
9. Hamming Code - Example
How to discover the error if occurred?
Suppose the bit number 7 is arrived incorrectly (altered from 0 to 1) and you do not
know where is error?
0 0 1 1 1 0 1 1 0 1 0 0
Again, compute p1, p2, p4, and p8 at the receiver side
P1= XOR{0,1,1,1,0,0} = 1
P2= {0,1,,0,1,1} = 1
P4= {1,1,0,1,0}=1
p8= XOR{1,0,1,0,0} = 0
So, the result of (P8 P4 P2 P1) is (0111) by converting this number to decimal
we found that it equal 7 which means that the error in the position 7.
So, you can correct it by converting to 0.
10. Error-Detecting Codes - Cyclic
Redundancy Check (CRC)
Figure 9: Design of Encoder and Decoder
11. Error-Detecting Codes – CRC (Cont.)
Example
Suppose the original data is 100100 and divisor is
1101.
At the sender side:
1. We added to the original message number of zeros equal
the length of divisor -1.
2. Divide the generated new-data by given divisor.
3. The reminder is the CRC which will be appended in the
original message.
Reminder
So that we will append 3 zeros to the original message
(100100000) and divide it by divisor.
The transmitted data is 100100001.
And CRC is 001
XOR
0 0 = 0
0 1 = 1
1 0 = 1
1 1 = 0
12. Error-Detecting Codes – CRC (Cont.)
Example
In the previous example the transmitted
data is 100100001 and divisor is 1101.
Perform the division.
The result is equal 0 which means the data
was arrived correctly.
At the receiver side, https://www.youtube.com/watch?v=-5-cd2VP1n4
Once the message has been received, the message is divided by the generator,
If the result equal 0 then the received message is correct
CRC Video
13. The Channel Allocation Problem
If two frames are transmitted simultaneously, they overlap in time and the resulting
signal is garbled. This event is called a collision.
There are 2 solutions:
1. Static Channel Allocation
The channel's capacity is divided into fixed portions. Each user is then allocated a
portion for all time. If the user has no traffic to use in its portion, then it goes
unused.
2. Dynamic Channel Allocation
The allocation of the channel changes based on the traffic generated by the users.
Which is better ?
Static allocation performs better when the traffic is predictable.
Dynamic channel allocation tries to get better utilization and lower delay on a
channel when the traffic is unpredictable.
14. Taxonomy of Multiple Access Protocols
• Random Access Protocols (any sender can send data in any time)
Aloha
Slotted Aloha
Carrier sense multiple access (CSMA): Ethernet
• Controlled Access Protocols
polling
Reservation protocols
Token passing protocols
Channelization Protocols (bandwidth of the link is shared between different hosts)
Code-division multiple access (CDMA)
15. Random Access Protocols - Aloha
• If you have a packet, just send it.
• If multiple host/station try it and so there is collision, then try
resending it later!
16. Random Access Protocols - Slotted Aloha
• Synchronous, that is time is divided into slots
• Slot size is equal to the transmission time of a packet
• Sending data is allowed only at the beginning of these slots
• It is more efficient than Aloha because it reduces the number of collision.
• Collision time is the slot duration
17. Controlled Access Protocols - Token Passing
• Token is exchanged among hosts in fixed order.
• Host is authorized to send data when it receives a special frame called
token and release it after successful transmission.
• Problem: The failure of one host can crash the entire channel or if the
host accidentally neglects to release the token, then some recover
techniques must be involved to get the token back to work.