Chapter 06 - Link Layer (Home Reading)
Chapter 06 - Link Layer (Home Reading)
Let’s now examine three techniques for detecting errors in the transmitted data parity checks (to
illustrate the basic ideas behind error detection and correction), check summing methods (which
are more typically used in the transport layer), and cyclic redundancy checks (which are more
typically used in the link layer in an adapter).
Parity Checks
Perhaps the simplest form of error detection is the use of a single parity bit. Suppose that the
information to be sent, D in Figure 6.4, has d bits. In an even parity scheme, the sender simply
includes one additional bit and chooses its value such that the total number of 1s in the d + 1 bits
(the original information plus a parity bit) is even. For odd parity schemes, the parity bit value is
chosen such that there is an odd number of 1s. Figure 6.4 illustrates an even parity scheme, with
the single parity bit being stored in a separate field.
Receiver operation is also simple with a single parity bit. The receiver need only count the
number of 1s in the received d + 1 bits. If an odd number of 1-valued bits are found with an even
parity scheme, the receiver knows that at least one bit error has occurred. More precisely, it
knows that some odd number of bit errors have occurred.
But what happens if an even number of bit errors occur?
You should convince yourself that this would result in an undetected error. If the probability of
bit errors is small and errors can be assumed to occur independently from one bit to the next, the
probability of multiple bit errors in a packet would be extremely small. In this case, a single
parity bit might suffice. However, measurements have shown that, rather than occurring
independently, errors are often clustered together in “bursts.” Under burst error conditions, the
probability of undetected errors in a frame protected by single-bit parity can approach 50 percent
[Spragins 1991]. Clearly, a more robust error-detection scheme is needed (and, fortunately, is
used in practice!).
Checksumming Methods
In checksumming techniques, the d bits of data in Figure 6.4 are treated as a sequence of k-bit
integers. One simple checksumming method is to simply sum these k-bit integers and use the
resulting sum as the error-detection bits. The Internet checksum is based on this approach—bytes
of data are treated as 16-bit integers and summed. The 1s complement of this sum then forms the
Internet checksum that is carried in the segment header. The receiver checks the checksum by
taking the 1s complement of the sum of the received data (including the checksum) and checking
whether the result is all 0 bits. If any of the bits are 1, an error is indicated. In the TCP and UDP
protocols, the Internet checksum is computed over all fields (header and data fields included). In
IP, the checksum is computed over the IP header (since the UDP or TCP segment has its own
checksum).
Checksumming methods require relatively little packet overhead. For example, the checksums in
TCP and UDP use only 16 bits. However, they provide relatively weak protection against errors
as compared with cyclic redundancy check, which is discussed next and which is often used in
the link layer.
Q. Why is checksumming used at the transport layer and cyclic redundancy check used at
the link layer?
Recall that the transport layer is typically implemented in software in a host as part of the host’s
operating system. Because transport-layer error detection is implemented in software, it is
important to have a simple and fast error-detection scheme such as checksumming. On the other
hand, error detection at the link layer is implemented in dedicated hardware in adapters, which
can rapidly perform the more complex CRC operations.