Professional Documents
Culture Documents
Unit 2 (Part 1)
Unit 2 (Part 1)
Unit 2 (Part 1)
Networks
••
•
Error is a condition when the receiver’s information does not match the sender’s
information. During transmission, digital signals suffer from noise that can introduce
errors in the binary bits traveling from sender to receiver. That means a 0 bit may
change to 1 or a 1 bit may change to 0.
Data (Implemented either at the Data link layer or Transport Layer of the OSI Model)
may get scrambled by noise or get corrupted whenever a message is transmitted. To
prevent such errors, error-detection codes are added as extra data to digital
messages. This helps in detecting any errors that may have occurred during message
transmission.
Types of Errors
Single-Bit Error
A single-bit error refers to a type of data transmission error that occurs when one bit
(i.e., a single binary digit) of a transmitted data unit is altered during transmission,
resulting in an incorrect or corrupted data unit.
Single-Bit Error
No of prints: Page 1 of
19
Multiple-Bit Error
A multiple-bit error is an error type that arises when more than one bit in a data
transmission is affected. Although multiple-bit errors are relatively rare when
compared to single-bit errors, they can still occur, particularly in high-noise or high-
interference digital environments.
Multiple-Bit Error
Burst Error
No of prints: Page 2 of
19
Burst Error
No of prints: Page 3 of
19
Disadvantages
• Single Parity check is not able to detect even no. of bit error.
• For example, the Data to be transmitted is 101010. Codeword
transmitted to the receiver is 1010101 (we have used even parity).
Let’s assume that during transmission, two of the bits of code word
flipped to 1111101.
On receiving the code word, the receiver finds the no. of ones to be
even and hence no error, which is a wrong assumption.
Two-dimensional Parity check bits are calculated for each row, which is
equivalent to a simple parity check bit. Parity check bits are also calculated for
all columns, then both are sent along with the data. At the receiving end, these
are compared with the parity bits calculated on the received data.
No of prints: Page 4 of
19
Checksum
Disadvantages
• If one or more bits of a segment are damaged and the corresponding
bit or bits of opposite value in a second segment are also damaged.
No of prints: Page 6 of
19
Cyclic Redundancy Check (CRC)
No of prints: Page 7 of
19
Error Correction Techniques
Error correction techniques find out the exact number of bits that have been
corrupted and as well as their locations. There are two principle ways
• Hamming Codes
No of prints: Page 8 of
19
• Binary Convolution Code
• Reed – Solomon Code
• Low-Density Parity-Check Code
In this coding method, the source encodes the message by inserting redundant
bits within the message. These redundant bits are extra bits that are generated
and inserted at specific positions in the message itself to enable error detection
and correction. When the destination receives this message, it performs
recalculations to detect errors and find the bit position that has error.
The procedure for single error correction by Hamming Code includes two parts,
encoding at the sender’s end and decoding at receiver’s end.
The procedure used by the sender to encode the message encompasses the
following steps −
Once the redundant bits are embedded within the message, this is sent to the
destination.
If the message contains m number of data bits, r number of redundant bits are
added to it so that is able to indicate at least (m + r + 1) different states. Here, (m +
r) indicates location of an error in each of bit positions and one additional state
indicates no error. Since, r bits can indicate 2r states, 2r must be at least equal
to (m + r + 1). Thus the following equation should hold −
No of prints: Page 9 of
19
2r ≥ 𝑚 + 𝑚 + 1
Example 1 − If the data is of 7 bits, i.e. m = 7, the minimum value of r that will
satisfy the above equation is 4, (24 ≥ 7 + 4 + 1). The total number of bits in the
encoded message, (m + r) = 11. This is referred as (11,4) code.
Example 2 − If, m = 7 comes to 4, the positions of the redundant bits are as follows
−
The redundant bits are parity bits. A parity bit is an extra bit that makes the
number of 1s either even or odd. The two types of parity are −
• Even Parity − Here the total number of bits in the message is made even.
• Odd Parity − Here the total number of bits in the message is made odd.
Each redundant bit, ri, is calculated as the parity, generally even parity, based
upon its bit position. It covers all bit positions whose binary representation includes
a 1 in the ith position except the position of ri. Thus −
• r1 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the least significant position excluding 1 (3, 5, 7, 9, 11 and so on)
• r2 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the position 2 from right except 2 (3, 6, 7, 10, 11 and so on)
• r3 is the parity bit for all data bits in positions whose binary representation includes a 1 in
the position 3 from right except 4 (5-7, 12-15, 20-23 and so on)
Example 3 − Suppose that the message 1100101 needs to be encoded using even
parity Hamming code. Here, m = 7 and r comes to 4. The values of redundant bits
will be as follows −
No of prints: Page 10 of
19
Hence, the message sent will be 11000101100.
Using the same formula as in encoding, the number of redundant bits are
ascertained.
2r ≥ 𝑚 + 𝑚 + 1
where m is the number of data bits and r is the number of redundant bits.
Parity bits are calculated based upon the data bits and the redundant bits using
the same rule as during generation of c1, c2, c3, c4 etc. Thus
The decimal equivalent of the parity bits binary values is calculated. If it is 0, there
is no error. Otherwise, the decimal value gives the bit position which has error. For
No of prints: Page 11 of
19
example, if c1c2c3c4 = 1001, it implies that the data bit at position 9, decimal
equivalent of 1001, has error. The bit is flipped (converted from 0 to 1 or vice
versa) to get the correct message.
Step 1 − At first the number of redundant bits are calculated using the formula
2r ≥ m + r + 1. Here, m + r + 1 = 11 + 1 = 12. The minimum value of r such that
2r ≥ 12 is 4.
c1 = even_parity(1, 3, 5, 7, 9, 11) = 0
c3 = even_parity (4, 5, 6, 7) = 0
Step 4 - Since the value of the check bits c1c2c3c4 = 0000 = 0, there are no errors
in this message.
The Hamming code can be modified to correct a single error and detect double
errors by adding a parity bit as the MSB, which is the XOR of all other bits.
At the receiver’s end, error detection is done as shown in the following table −
No of prints: Page 12 of
19
What is Pure ALOHA?
•
The•• ALOHA protocol was first developed at the University of Hawaii in the early 1970s
for packet radio networks. However, it can be used in any situation where multiple
devices share a common communication channel. This protocol allows devices to
transmit data at any time, without a set schedule. This is known as a random access
technique, and it is asynchronous because there is no coordination between devices.
When multiple devices attempt to transmit data at the same time, it can result in a
collision, where the data becomes garbled. In this case, each device will simply wait a
random amount of time before attempting to transmit again. The basic concept of the
ALOHA protocol can be applied to any system where uncoordinated users are
competing for the use of a shared channel.
Pure ALOHA:
• Pure ALOHA refers to the original ALOHA protocol. The idea is that each
station sends a frame whenever one is available. Because there is only one
channel to share, there is a chance that frames from different stations will
collide.
• The pure ALOHA protocol utilizes acknowledgments from the receiver to
ensure successful transmission. When a user sends a frame, it expects
confirmation from the receiver. If no acknowledgment is received within a
designated time period, the sender assumes that the frame was not
received and retransmits the frame.
• When two frames attempt to occupy the channel simultaneously, a collision
occurs and both frames become garbled. If the first bit of a new frame
overlaps with the last bit of a frame that is almost finished, both frames will
be completely destroyed and will need to be retransmitted. If all users
retransmit their frames at the same time after a time-out, the frames will
collide again.
• To prevent this, the pure ALOHA protocol dictates that each user waits a
random amount of time, known as the back-off time, before retransmitting
the frame. This randomness helps to avoid further collisions.
No of prints: Page 13 of
19
Pure ALOHA procedure
No of prints: Page 14 of
19
Vulnerable period for packet A
• Similarly, if another user wants to transmit between (to, +tp) and (to +2tp)
i.e. packet C, the beginning of packet C will collide with the end of packet A.
Thus if two packets overlap by even the smallest amount in the vulnerable
period both packets will be corrupted and need to be retransmitted.
Key Features of Pure ALOHA:
1. Random Access: Devices can send data whenever they have something to
transmit, without needing to wait for a predetermined time slot.
2. Uncoordinated Transmission: Devices do not coordinate with each other before
transmitting. They simply attempt to send data whenever they have data to send.
No of prints: Page 15 of
19
As a result, wasted time due to collisions can be reduced to one packet time or the
susceptible period can be half.
When a user wants to transmit a frame, it waits until the next time slot and then sends
the frame. If the frame is received successfully, the receiver sends an acknowledgment.
If the acknowledgment is not received within a time-out period, the sender assumes
that the frame was not received and retransmits the frame in the next time slot.
Transmission attempts and random retransmission delay for colliding packets in slotted ALOHA
No of prints: Page 16 of
19
Throughput of Slotted ALOHA:
The quantity of successful transmissions at each time slot determines the throughput
of the Slotted Aloha protocol. The Slotted Aloha protocol has a maximum throughput
of about 18.4%. This is because there is a significant risk of collisions when numerous
nodes try to transmit at the same time, which causes missed packets and a decreased
overall throughput. When less than or equal to 37% of the network’s total nodes are
actively transmitting data, the maximum throughput is reached.
Due to the high frequency of collisions, the throughput of Slotted Aloha is typically
substantially lower than 18.4% in practice It is not a widely used protocol in today’s
contemporary networks because of this.
Comparison of the throughput as a function of offered load for Pure and Slotted ALOHA
The throughput is a function of the offered load and it ranges from 0 to 1. As the offered
load increases, the throughput decreases as more collisions occur, resulting in less
successful transmissions. The maximum throughput is achieved when the offered load
is equal to 0.37 and it is approximately 0.184.
No of prints: Page 17 of
19
It is important to note that the above equation assumes that all the packets are of the
same length and that the channel is error-free. In practice, the throughput is usually
much lower than this due to a number of factors such as packet errors, channel noise,
and the overhead of retransmissions.
Assumption of Slotted ALOHA:
• All frames are of the same size.
• Time is divided into equal-sized slots, a slot equals the time to transmit one
frame
• Nodes start to transmit frames only at beginning of slots.
• Nodes are synchronized.
• If two or more nodes transmit in a slot, all nodes detect collision before the
slot ends.
Advantages of Slotted ALOHA:
• Simplicity: The Slotted Aloha protocol is relatively simple to implement
and understand, making it an easy option for low-complexity networks.
• Flexibility: Slotted Aloha can be used in a wide range of network
environments, including those with varying numbers of nodes and varying
traffic loads
• Low overhead: Slotted Aloha does not require complex management or
control mechanisms, which can help to reduce the overhead and complexity
of the network.
Disadvantages of Slotted ALOHA:
• Low throughput: The maximum throughput of the Slotted Aloha protocol
is relatively low at around 18.4%, which can be limiting for high-bandwidth
applications.
• High collision rate: The high collision rate in slotted ALOHA can result in a
high packet loss rate, which can negatively impact the overall performance
of the network.
• Inefficiency: The protocol is inefficient at high loads, as the efficiency
decreases as the number of nodes attempting to transmit increases.
In this Aloha, any station can transmit In this, any station can transmit the data at the
the data at any time. beginning of any time slot.
In this, The time is continuous and not In this, The time is discrete and globally
globally synchronized. synchronized.
Pure Aloha doesn’t reduce the number Slotted Aloha reduces the number of collisions
of collisions to half. to half and doubles the efficiency of Pure Aloha.
Answer:
The advantage of pure aloha over slotted aloha is that there is no fixed size, and
it has the ability to start transmission at any particular time and no need for
synchronization.
2. What is the formula for throughput of Pure Aloha and Slotted Aloha?
Answer:
Pure Aloha: S = G x e -2G
Slotted Aloha: S = G x e -G
No of prints: Page 19 of
19