CN-BCS502-Module2-Notes
CN-BCS502-Module2-Notes
MODULE-2
Data Link Layer: Error Detection and Correction: Introduction, Block Coding, Cyclic Codes.
Data link control: DLC Services: Framing, Flow Control, Error Control, Connectionless and
Connection Oriented, Data link layer protocols, High Level Data Link Control. Media Access
Control: Random Access, Controlled Access. Check Sum and Point to Point Protocol
Textbook: Ch. 10.1-10.4, 11.1 -11.4, 12.1 - 12.2
Types of Errors
There are two types of error: Single bit error and Burst error.
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. Single-bit errors are the least likely type of error
in serial data transmission.
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. In the below figure, 0100010001000011 was sent, but 0101110101100011 was
received.
Note that a burst error does not necessarily mean that the errors occur in consecutive bits. The length of
the burst is measured from the first corrupted bit to the last corrupted bit. Some bits in between may
not have been corrupted.
1
Computer Networks (BCS502)-Notes
Redundancy/Redundant bits:
To detect or correct errors some extra bits are sent with data. These redundant bits are added by the
sender and removed by the receiver. Their presence allows the receiver to detect or correct corrupted
bits.
Coding
• Redundancy is achieved through various coding schemes.
• The sender adds redundant bits through a process that creates a relationship between the
redundant bits and the actual data bits.
• The receiver checks the relationships between the two sets of bits to detect or correct the errors.
Coding schemes can be divided into two broad categories: block coding and convolution
coding.
2
Computer Networks (BCS502)-Notes
3
Computer Networks (BCS502)-Notes
Error Detection
If the following two conditions are met, the receiver can detect a change in the original
codeword:
• The receiver has (or can find) a list of valid codewords.
• The original codeword has changed to an invalid one.
Process of error detection in block coding
• The sender creates codewords out of datawords by using a generator that applies the
rules and procedures of encoding.
• Each codeword sent to the receiver may change during transmission.
• If the received codeword is the same as one of the valid codewords, the word is
accepted; the corresponding dataword is extracted for use. If the received codeword is
not valid, it is discarded.
• However, if the codeword is corrupted during transmission but the received word still
matches a valid codeword, the error remains undetected.
• This type of coding can detect only single errors. Two or more errors may remain
undetected.
Example:
Let us assume that k =2 and n =3. Below Table shows the list of datawords and codewords.
Dataword Codeword
00 000
01 011
10 101
11 110
Assume the sender encodes the dataword 01 as 011 and sends it to the receiver. Consider the
following cases:
• The receiver receives 011. It is a valid codeword. The receiver extracts the dataword 01
from it.
• The codeword is corrupted during transmission, and 111 is received (the leftmost bit is
4
Computer Networks (BCS502)-Notes
5
Computer Networks (BCS502)-Notes
• The codeword is corrupted during transmission, and 000 is received (the right two bits
are corrupted). This is a valid codeword. The receiver incorrectly extracts the dataword
00. Two corrupted bits have made the error undetectable.
Error Correction
In error detection, the receiver needs to know only that the received codeword is invalid; in
error correction the receiver needs to find (or guess) the original codeword sent.
6
Computer Networks (BCS502)-Notes
5. The original codeword must be the second one in the table because this is the only one
that differs from the received codeword by 1 bit. The receiver replaces 01001 with
01011 and consults the table to find the dataword 01.
Hamming Distance
• One of the central concepts in coding for error control is the idea of the Hamming
distance.
• The Hamming distance between two words (of the same size) is the number of
differences between the corresponding bits.
• Hamming distance between two words x and y as d(x, y).
o Condition: d=0; bits not corrupted
d ≠ 0; bits corrupted
• Hamming distance between the received codeword and the sent codeword is the
number of bits that are corrupted during transmission.
• For example, if the codeword 00000 is sent and 01101 is received, 3 bits are in error
and the Hamming distance between the two is d(00000, 01101) = 3.
• The Hamming distance can easily be found if we apply the XOR operation – counts the
number of 1s in the result.
Example:
7
Computer Networks (BCS502)-Notes
Let us assume that the sent codeword x is at the center of a circle with radius s. All received
codewords that are created by 0 to s errors are points inside the circle or on the perimeter of the
circle.
All other valid codewords must be outside the circle, as shown in Figure. This means that d min
must be an integer greater than s or dmin = s + 1.
one error occurs, the received codeword does not match any valid codeword.
• If two errors occur, however, the received codeword may match a valid codeword and
the errors are not detected.
Example 2:
A code scheme has a Hamming distance dmin = 4. This code guarantees the detection of up
to 3 errors (d = s + 1 or s = 3).
8
Computer Networks (BCS502)-Notes
Parity-Check Code
• Perhaps the most familiar error-detecting code is the parity-check code.
• This code is a linear block code. In this code, a k-bit dataword is changed to an n-
bit codeword where n = k + 1.
• The extra bit, called the parity bit, is selected to make the total number of 1s in the
codeword even.
• Some cases gives odd number on 1s.
• The minimum Hamming distance for this category is
Dataword Codeword
dmin = 2, which means that the code is a single-bit error- 00 000
detecting code. Our first code is a parity-check code (k = 01 011
10 101
2 and n = 3). 11 110
9
Computer Networks (BCS502)-Notes
Encoder:
• The calculation is done in modular arithmetic.
• The encoder uses a generator that takes a copy of a 4-bit dataword (a0, a1, a2, and a3)
and generates a parity bit r0.
• The dataword bits and the parity bit create the 5-bit codeword. The parity bit that is
added makes the number of 1s in the codeword even.
• This is normally done by adding the 4 bits of the dataword (modulo-2); the result is the
parity bit. In other words,
r0 = a3 + a2 + a1 + a0 (modulo-2)
Note: If the number of 1s is even, the result is 0; if the number of 1s is odd, the result is 1.
In both cases, the total number of 1s in the codeword is even.
Decoder:
• The sender sends the codeword, which may be corrupted during transmission.
• The receiver receives a 5-bit word. The checker at the receiver does the same thing as
the generator in the sender with one exception: The addition is done over all 5 bits.
• The result, which is called the syndrome, is just 1 bit.
• The syndrome is 0 when the number of 1s in the received codeword is even; otherwise,
it is 1.
• The syndrome is passed to the decision logic analyzer.
• If the syndrome is 0, there is no detectable error in the received codeword
• If the syndrome is 1, the data portion of the received codeword is discarded. The
dataword is not created.
10
Computer Networks (BCS502)-Notes
Example:
Assume the sender sends the dataword 1011. The codeword created from this dataword is 10111,
which is sent to the receiver. We examine five cases:
1. No error occurs; the received codeword is 10111. The syndrome is 0. The dataword
1011 is created.
2. One single-bit error changes a1. The received codeword is 10011. The syndrome is 1.
No dataword is created.
3. One single-bit error changes r0. The received codeword is 10110. The syndrome is 1.
No dataword is created. Note that although none of the dataword bits are corrupted, no
dataword is created because the code is not sophisticated enough to show the position
of the corrupted bit.
4. An error changes r0 and a second error changes a3. The received codeword is 00110.
The syndrome is 0. The dataword 0011 is created at the receiver. Note that here the
dataword is wrongly created due to the syndrome value. The simple parity-check
decoder cannot detect an even number of errors. The errors cancel each other out and
give the syndrome a value of 0.
5. Three bits—a3, a2, and a1—are changed by errors. The received codeword is 01011.
The syndrome is 1. The dataword is not created. This shows that the simple parity
check, guaranteed to detect one single error, can also find any odd number of errors.
11