Unit 3 Computer CN Hand Written Notes
Unit 3 Computer CN Hand Written Notes
Ques: Explain the Binary Exponential Back-off (BEB) with suitable example ? [Dec2024]
Ans: Binary Exponential Back-off is a collision resolution algorithm used in network communication protocols like Ethernet
(CSMA/CD) and Wi-Fi (CSMA/CA). It controls how devices retry transmitting data after a collision happens on a shared
communication medium.
Why is BEB needed?
In networks where multiple devices share the same communication channel, two or more devices might try to send data
simultaneously, causing a collision. When this happens, the data is corrupted and must be resent. If all devices try to resend
immediately, collisions will keep occurring, creating network congestion.
BEB helps by making devices wait for a random amount of time before trying to resend, reducing the chances that they
collide again.
How does Binary Exponential Back-off work?
1. Collision Detection: When a device detects that its data transmission collided with another device's transmission, it
stops sending data.
2. Wait Time Calculation: The device waits for a random number of time slots before trying to retransmit. This
random waiting time is chosen from a range of numbers between 0 and (2^k - 1), where k is the number of
collisions the device has experienced for that frame.
3. Exponential Increase: After each collision, the range doubles, exponentially increasing the waiting time window.
This exponential growth helps spread out retransmission attempts over time to avoid repeated collisions.
4. Maximum Limit: The value of k is limited to a maximum number (usually 10 or 16). After that, the back-off range
does not increase further, and if collisions continue, the transmission is dropped.
Example:
First collision (k = 1):
The device picks a random wait time from 0 to 1 time slot (2^1 - 1 = 1).
It might wait for 0 or 1 slot before retrying.
Second collision (k = 2):
The device picks a random wait time from 0 to 3 time slots (2^2 - 1 = 3).
It might wait for 0, 1, 2, or 3 slots before retrying.
Third collision (k = 3):
The device picks a random wait time from 0 to 7 time slots (2^3 - 1 = 7).
It might wait for any number from 0 to 7 slots.
This process repeats until the device successfully sends the data or reaches the maximum retry limit.
Why is BEB effective?
Reduces Collisions: By spreading out retransmission times, devices avoid trying to send simultaneously.
Adapts to Network Load: When collisions are rare, back-off times are short, allowing faster retransmission. When
collisions increase, back-off times grow exponentially to reduce network congestion.
Simple to Implement: The algorithm only needs a random number generator and counters.
Ques: Explain in briefly about the Persistent and Non- Persistent CSMA Protocol ? [Dec2024]
Ans: Carrier Sense Multiple Access (CSMA) is a method used in networks where many devices share the same
communication channel. Before sending data, a device listens to the channel to check if someone else is already
transmitting. If the channel is busy, it waits until it becomes free.
This “listen before talk” approach helps reduce collisions (when two devices send data at the same time), which was a big
problem in older systems like ALOHA. However, collisions can still happen because of delays in sensing the channel,
especially in large networks. When collisions occur, the devices stop transmitting and try again after waiting for a random
time. This way, CSMA improves overall network performance and efficiency.
TYPE OF CASMA Access model
(i) 1-Persistent CSMA (Carrier Sense Multiple Access)
the station follows a strict rule to send data as soon as the channel is found to be free. The steps are:
1. The station continuously senses the channel to check if it is idle or busy.
2. If the channel is busy, it keeps waiting and sensing until it becomes idle.
3. As soon as the channel is idle, it immediately transmits the data with probability 1 (100%).
Why it's called "1-Persistent":
The term "1-Persistent" means the station has a 100% chance of transmitting as soon as the channel becomes free.
Example:
Suppose two stations (A and B) both want to send data.
Both are sensing the channel.
As soon as the channel becomes free, both stations transmit immediately.
This causes a collision.
Drawbacks of 1-Persistent CSMA:
1.High Collision Chance: Multiple stations may transmit at the same time when the channel becomes idle.
2. Propagation Delay Issue: A station may not detect an ongoing transmission due to signal delay, causing collisions.
3. Wasted Bandwidth: Collisions lead to data loss and require retransmission, reducing overall efficiency.
4. Unfair Waiting: Stations that just missed the idle channel may have to wait longer, leading to unfair access.
Ques: Explain the working principle of Slotted ALOHA with suitable sketch ? [May 2023]
Ans: Slotted ALOHA is a random access protocol in which the time is divided into discrete slots, and stations are allowed to
transmit data only at the beginning of these time slots to reduce collisions and improve channel efficiency.
Slotted ALOHA – Working Principle
1. In Slotted ALOHA, time is divided into equal time slots.
2. A station is only allowed to send data at the beginning of a time slot.
3. These time slots are exactly equal to the time needed to send one packet.
4. All users are synchronized to these time slots. This means everyone waits for the next slot to start before
transmitting.
5. This system reduces collision time to just one packet time.
6. When a user wants to send a frame, it waits for the next time slot and then transmits.
7. If the receiver gets the frame successfully, it sends back an acknowledgment.
8. If the sender does not receive acknowledgment, it assumes a collision occurred and retries in another time slot.
9. Slotted ALOHA increases channel efficiency compared to pure ALOHA because fewer collisions happen.
10. However, users may experience more delay because they must wait for the next time slot before transmitting.
Ques: What is Limited contention Protocols? Explain the working principle of Adaptive Tree Walk Protocol with suitable
Example? [May 2023]
Ans: Limited Contention Protocols: Adaptive Tree Walk
Limited Contention Protocols are hybrid protocols that combine the advantages of both contention-based and contention-
free protocols.
At low traffic load, they use contention-based methods to keep delay low.
At high traffic load, they switch to a contention-free approach to maintain high channel efficiency.
These protocols work by reducing the number of stations competing at any given time (limiting contention).
They divide stations into groups, and only one group competes for the channel at a time (contention happens within a
limited set of stations).
If a station in the group successfully acquires the channel, it transmits; if not (collision or no station wants to send), the next
group gets a chance.
This division into groups reduces competition, increasing the chance of successful transmissions and improving overall
network performance.
Types of CSMA:
1. CSMA/CD (Collision Detection)
After sending data, the device checks if a collision happened. If yes, it stops, waits a random time, and
tries again.
2. CSMA/CA (Collision Avoidance)
Used mainly in wireless networks where it’s hard to detect collisions. Devices try to avoid collisions by
waiting for random times and sending acknowledgments when data is received successfully.
Advantages of CSMA:
Efficient use of the network.
Simple and easy to implement.
Works on wired and wireless networks.
Low cost.
Disadvantages of CSMA:
Not good for very large networks.
Can cause delays when the network is busy.
May have unreliable communication due to interference.
Vulnerable to attacks like jamming.
Basic Idea:
Goal: Stations should be able to receive while transmitting to detect collisions from different stations.
In Wired Networks: When a collision occurs, the energy of the received signal nearly doubles, so the station can
easily detect it.
In Wireless Networks: Most energy is used for transmission, and a collision only raises received signal energy by 5-
10%, making collision detection by the station very difficult.
Result: CSMA/CA is specially designed for wireless networks to avoid collisions rather than detect them.
Bit-map Protocol
Binary Countdown
Limited Contention Protocols
The Adaptive Tree Walk Protocol
Pure and slotted Aloha, CSMA and CSMA/CD are Contention based Protocols:
Try-if collide-Retry
No guarantee of performance
What happen if the network load is high?
Collision Free Protocols:
Pay constant overhead to achieve performance guarantee
Good when network load is high
Binary Countdown Protocol is used to reduce the overhead of sending extra bits by using the stations’ binary addresses to
decide who gets to send data first. Every station that wants to send data broadcasts its address as a binary number, starting
with the leftmost (most important) bit.
All station addresses are the same length. When multiple stations want to send data at the same time, they compare their
binary addresses bit by bit to decide who has the highest priority to use the channel.
Example: Suppose four stations with addresses 0001, 1001, 1100, and 1011 want to send data at the same time.
First, all stations send their first bit:
o Station 0001 sends 0
o Station 1001 sends 1
o Station 1100 sends 1
o Station 1011 sends 1
Since 0001 sees others sending 1, it knows another station has a higher address, so it stops trying in this round.
Next, the remaining stations (1001, 1100, 1011) send their second bit:
o 1001 sends 0
o 1100 sends 1
o 1011 sends 0
Stations 1001 and 1011 see a 1 from 1100, so they give up.
Station 1100 wins and starts transmitting its data.
After 1100 finishes, the process repeats for other stations that want to send.
Unit 4
Let’s say a large datagram has 4000 bytes of data. These bytes are numbered from 0 to 3999. Now, suppose this
datagram is too large for the network and needs to be broken into 3 fragments.
First Fragment
🔧 Purpose of ICMP:
Reports errors (like unreachable destination).
Used for network diagnostics (like ping and traceroute).
Helps in troubleshooting connectivity issues.
Works closely with the IP protocol, but it is not used to exchange data between applications.
Ques: Explain various classes of IP addresses in terms of their network-ID bits, host-ID bits, number of possible
host, number of possible network and range for each classes.
Ans:
IP addresses are divided into five classes: A, B, C, D, and E.
Each class has a different number of Network ID bits and Host ID bits, which decides how many networks and
hosts per network can be made.
✅ Class A
🧠 Network ID: 8 bits
🧑💻 Host ID: 24 bits
Networks ban sakte hain: 128 (but 126 hi use hote hain)
👥 Har network mein devices (hosts): 16 million+
📍 IP Range: 1.0.0.0 se 126.255.255.255
🔧 Use: Bahut bade companies ke liye (jaise Google, Microsoft)
✅ Class B
🧠 Network ID: 16 bits
🧑💻 Host ID: 16 bits
Networks: 16,384
👥 Har network mein hosts: 65,534
📍 IP Range: 128.0.0.0 se 191.255.255.255
🔧 Use: Medium level networks ke liye (jaise colleges, universities)
✅ Class C
🧠 Network ID: 24 bits
🧑💻 Host ID: 8 bits
Networks: 20 lakh+
👥 Har network mein hosts: 254
📍 IP Range: 192.0.0.0 se 223.255.255.255
🔧 Use: Small businesses ya ghar ke liye
✅ Class D – Multicast
🧑🏫 Use hota hai ek saath multiple devices ko data bhejne ke liye
🛑 Isme host ya network ID nahi hoti
📍 IP Range: 224.0.0.0 se 239.255.255.255
✅ Class E – Experimental
🧪 Ye research aur future use ke liye rakha gaya hai
🛑 Normally use nahi hota
📍 IP Range: 240.0.0.0 se 255.255.255.255
📋 Ek Simple Table (Easy to Remember)
Class Network Bits Host Bits Networks Hosts IP Range Use
A 8 24 126 1.6 crore 1.0.0.0 – 126.255.255.255 Big Companies
B 16 16 16,384 65K 128.0.0.0 – 191.255.255.255 Colleges, Medium Org
C 24 8 20+ Lakh 254 192.0.0.0 – 223.255.255.255 Small Businesses, Homes
D - - - - 224.0.0.0 – 239.255.255.255 Multicast, group communication
E - - - - 240.0.0.0 – 255.255.255.255 Research, Testing
Ques: Describe the working principle of Least Cost Routing using suitable example.