Computer Networks
Computer Networks
Hamming Code
Hamming code is a forward error-correcting code developed by Richard Hamming in 1950.
It is used to detect and correct errors in data transmission over unreliable communication
channels. The main concept of Hamming code is to add redundant bits (called parity bits) to
the original data in such a way that if an error occurs during transmission, the receiver can
identify and correct it.
The number of parity bits required depends on the size of the data and follows the formula:
2^r >= m + r + 1, where r is the number of parity bits and m is the number of data bits.
Hamming code can detect up to two errors and correct a single-bit error, making it suitable
for systems requiring high reliability. The redundant parity bits are placed at positions in
the data that are powers of two (1, 2, 4, 8, etc.). The receiver recalculates the parity bits and
compares them with the transmitted ones to locate the error position and correct it.
Hamming code is widely used in computer memory systems, data storage, and digital
communication to enhance data integrity.
3. Slotted ALOHA
Slotted ALOHA is a modified version of the pure ALOHA protocol, designed to reduce the
number of collisions in data transmission. In this protocol, time is divided into discrete
slots, and stations are allowed to transmit only at the beginning of a time slot. This
decreases the probability of collisions compared to pure ALOHA, where stations can
transmit at any time.
If two or more stations try to transmit in the same time slot, a collision occurs, and the data
is lost. The affected stations must wait for a random period before retransmitting. Slotted
ALOHA increases the maximum possible throughput compared to pure ALOHA, achieving a
theoretical maximum throughput of 37%. However, collisions still occur, especially in highly
loaded networks.
Slotted ALOHA is used in environments where multiple devices need to share the same
communication channel, such as satellite communication systems and some wireless
networks. It provides a balance between simplicity and improved efficiency compared to
pure ALOHA, although its efficiency is still limited by the occurrence of collisions.
(a) When the system produces 1000 frames per second, the throughput is:
(b) When the system produces 500 frames per second, the throughput is:
(c) When the system produces 250 frames per second, the throughput is:
The throughput decreases as the number of frames produced per second decreases because
fewer frames are transmitted successfully per unit time. Throughput depends on the
probability of successful transmission, which is affected by the number of frames and the
likelihood of collisions in the network.
5. CRC in Trailer
In data link protocols, the Cyclic Redundancy Check (CRC) is placed in the trailer of the
frame rather than in the header for practical reasons. The CRC is calculated based on the
entire frame, including both the header and data. If the CRC were placed in the header, it
would be impossible to calculate the CRC value for the entire frame before transmission.
Placing the CRC in the trailer ensures that the entire frame can be checked for errors after it
is fully assembled.
For example, given the dataword “1101011011” and the divisor “10011,” the generation of
the CRC codeword involves binary division of the dataword by the divisor. The remainder of
the division is appended to the dataword to form the CRC codeword. This remainder is sent
with the data, and the receiver uses the same division to check for errors. If the remainder
at the receiver is zero, the data is considered error-free; otherwise, an error has occurred
during transmission.
6. Link State Routing
Link state routing is a dynamic routing protocol that uses a global view of the network to
determine the shortest path from source to destination. The protocol is based on Dijkstra’s
algorithm, where each router calculates the best path to every other router in the network.
The key steps involved in link state routing are:
1. Neighbor Discovery: Each router identifies its directly connected neighbors and measures
the cost to reach them.
2. Link State Advertisement (LSA): Each router creates a Link State Packet (LSP) that
contains its ID, the IDs of its neighbors, and the cost to reach them.
3. Flooding: The router floods the LSP to all other routers in the network. This ensures that
every router has a complete map of the network topology.
4. Shortest Path Calculation: Using Dijkstra’s algorithm, each router calculates the shortest
path to all other routers based on the LSPs.
5. Routing Table Update: The router updates its routing table with the best path to each
destination.
An LSP contains information about the router’s ID, its neighbors, and the link costs. This
information is used to calculate the shortest paths in the network.