Local Area Networks (LANs) & Medium Access Control
1. LAN Basics & Topologies
A Local Area Network (LAN) covers a short physical distance and connects multiple devices for sharing data at high rates.
- Bus: All stations share a single communication channel. Only one station can transmit at a time.
- Ring: Consists of repeaters in a closed loop. Links are unidirectional. A frame circulates around the ring, the destination copies it, and the source removes it.
- Star (Most Popular): All stations connect to a central node.
- If the central node is a Hub, it acts logically like a Bus (broadcasts to everyone).
- If the central node is a Switch, it acts as a frame-switching device (directs traffic only to the destination).
2. Hubs vs. Switches
- Hub (Layer 1 - Physical):
- Acts as a repeater. When one station transmits, the hub broadcasts the signal to all stations.
- Collision Domain: All stations are in the same collision domain. If two stations transmit at the same time, a collision occurs.
- Capacity: Bandwidth is shared. As more stations are added, each gets a decreasing share of the fixed capacity.
- Switch (Layer 2 - Data Link):
- Buffers incoming frames and retransmits them only on the specific outgoing link to the destination.
- Collision Domain: Each port is its own independent collision domain.
- Capacity: If the cable is full-duplex, collisions are impossible. Stations can send frames simultaneously without worrying about other ports.
3. Channel Allocation Strategies
When multiple users share a single channel (like a satellite or a shared wire), we must decide who gets to talk.
- Static Allocation:
- FDMA (Frequency Division): Channel divided into frequency bands.
- TDMA (Time Division): Channel divided into time slots.
- CDMA (Code Division): Transmitters send simultaneously using different mathematical codes.
- Disadvantage: Rigid. If a user has nothing to send, their frequency/time slot is completely wasted.
- Dynamic/Contention-Based Allocation:
- Stations transmit when they have data. No advance coordination.
- Disadvantage: If frames overlap in time, a collision occurs, and both frames are lost, diminishing throughput.
4. ALOHA Protocols
The earliest contention-based protocols.
- Pure ALOHA:
- Rule: Users transmit whenever they want. If there is a collision, wait a random time and retransmit.
- Vulnerable Period: (A frame can collide with a frame sent just before it or just after it).
- Throughput (): (Maximum throughput is ).
- Slotted ALOHA:
- Rule: Time is divided into discrete slots. Stations must wait for the beginning of the next slot to transmit.
- Vulnerable Period: (This halves the vulnerable period because frames can only collide if they start in the exact same slot).
- Throughput (): (Maximum throughput is ).
Math Note (Poisson Distribution): The probability of exactly frames being generated when the average load is is:
5. CSMA (Carrier Sense Multiple Access)
“Listen before you talk.” Stations detect what others are doing and adapt.
- 1-persistent CSMA: Listen to the channel. If idle, transmit immediately (probability of 1). If busy, wait until it becomes idle and then immediately transmit. (Trap: If two stations are waiting for a busy channel to clear, they will 100% collide when it does).
- Non-persistent CSMA: Listen to the channel. If idle, transmit. If busy, wait a random period of time and check again. (Reduces collisions, but increases delay).
- p-persistent CSMA: If idle, transmit with probability . Defer to the next slot with probability .
6. Ethernet & CSMA/CD
Classic Ethernet uses 1-persistent CSMA/CD (Collision Detection).
- Stations listen, send if idle, and monitor the channel while sending.
- If a collision is detected, they abort the transmission, send a short “jam signal”, and wait a random interval before retransmitting.
Binary Exponential Backoff (BEB) Algorithm
How Ethernet decides the random waiting time after a collision:
- After collisions, a station chooses a random number of slots to wait from the range .
- 1st collision: Choose from
- 2nd collision: Choose from
- 3rd collision: Choose from
- Freeze: After 10 collisions, the interval is frozen at a maximum of 1023 slots.
- Abort: After 16 collisions, the hardware gives up and reports a failure.
7. Ethernet Performance (Efficiency Math)
The efficiency of a CSMA/CD network depends on the Transmission Delay (), the Propagation Delay (), and the probability that exactly one station successfully acquires the channel ().
- Formula:
Sample Exam Questions & Solutions
Question 1: ALOHA Probability (Math)
Consider a shared channel using the ALOHA protocol. The frame time is 10 ms. There are 10 terminals, and each terminal generates frames at a mean rate of 1 frame per second. a) What is the total load () per frame time? b) What is the probability that exactly 1 frame is generated during one frame time?
Solution: a) Total rate () = . The frame time () is . Load () = . b) Use the Poisson distribution formula for : (or 9.05%).
Question 2: Binary Exponential Backoff (Math)
Two nodes on an Ethernet network attempt to transmit at the same time and collide. They both apply the Binary Exponential Backoff algorithm. They happen to pick the same random number and collide a second time. What is the probability that they will collide on their third attempt?
Solution: After the 2nd collision, the collision counter . The range of slots they can pick from is . Both stations independently pick a random number from the set .
- Total possible combinations = .
- They will collide if they pick the exact same number: (0,0), (1,1), (2,2), or (3,3). There are 4 collision combinations.
- Probability = (or 25%).
Question 3: CSMA Protocols (Theory)
Explain the operational difference between 1-persistent CSMA and non-persistent CSMA when a station senses that the channel is currently busy.
Solution: In 1-persistent CSMA, if a station senses a busy channel, it continues to listen continuously and transmits immediately (with a probability of 1) the exact moment the channel becomes idle. In non-persistent CSMA, if a station senses a busy channel, it does not keep listening. Instead, it waits for a completely random period of time before checking the channel again. This results in better channel utilization (fewer collisions) but introduces longer delays.
Question 4: Ethernet Channel Efficiency (Math)
Consider a classic Ethernet network. Suppose the frame transmission time () is 200 and the one-way propagation delay () is 25 . The probability that a station successfully acquires the channel in a contention slot () is calculated to be 0.0005. Calculate the channel efficiency ().
Solution: The formula for Ethernet channel efficiency is . Substitute the values: The channel efficiency is approximately 0.199%.