π Lecture 21 β Switch: Collision Avoidance
π Overview: This lecture explains how a switch avoids collisions when forwarding multiple frames to the same destination. By using buffers to temporarily store frames, a switch can prevent collisions that would otherwise occur when multiple frames need to go out the same port, though this introduces a small buffering delay.
ποΈ Topics Covered
The lecture examines the collision avoidance logic of switches, including the problem of multiple frames being forwarded to the same destination simultaneously. It details how buffers inside the switch store frames temporarily to prevent collisions, updates the switch logic to include buffering, and calculates the buffering delay introduced by this process using a concrete example with three 1250-byte frames.
π Lecture Summary
Collision Avoidance via Buffers
When a switch receives a frame, it examines the destination Ethernet address and forwards the frame out only the one port through which that address can be reached. A problem arises if everyone wants to send to the same destination (e.g., Fred) at the same time β the switch would try to forward all frames simultaneously, causing a collision. A switch receives on pins 1 and 2 and transmits on pins 3 and 6.
To avoid sending all frames at once, the switch uses buffers β memory inside the switch used to store frames temporarily. The switch sends one frame immediately and keeps the other two frames in buffers. After finishing the first frame, it retrieves one from the buffer and sends it, then retrieves the third frame from the buffer and sends it. By doing so, the switch usually avoids causing a collision.
π Definition β Buffer: Memory inside a switch used to store frames temporarily while waiting for a port to become available.
π Buffering Delay Formula: The delay introduced by buffering is determined by the total size of all buffered frames divided by the transmission rate. β Frame transmission time = Frame size (in bits) / Transmission rate (in bps) β Total time = Number of frames Γ Frame transmission time
π Example: Three frames, each 1250 bytes long, sent over a 10 Mbps cable from the switch to Fred.
- Frame size in bits = 1250 bytes Γ 8 bits/byte = 10,000 bits
- Transmission rate = 10 Mbps = 10,000,000 bps
- Time per frame = 10,000 bits / 10,000,000 bps = 0.001 seconds = 1 millisecond
- Total time for all three frames = 3 Γ 1 ms = 3 milliseconds (0.003 seconds)
π‘ Why this matters: If collisions had occurred instead of buffering, each frame would have taken significantly longer due to collision recovery mechanisms, making buffering far more efficient.
Updated Switch Logic
The switch logic is updated to include buffering: When receiving a frame, examine the destination Ethernet address. Forward the frame out the one port and only that port through which that address can be reached. If multiple frames need to be sent out to the same port, send one frame and buffer the rest. As soon as the port becomes available, send the other frames.
By buffering frames, a delay is introduced called buffering delay. For instance, if three frames were each 1250 bytes long, it would only take 3 milliseconds (0.003 seconds) for all three to be sent over the cable with a 10 Mbps rate from the switch to Fred. If collisions had occurred, each frame would have taken significantly longer.
π Definition β Buffering delay: The time delay introduced when a switch temporarily stores frames in memory while waiting for a port to become available.
β Key Takeaways
A switch avoids collisions by buffering frames that need to go out the same port β it sends one frame immediately and stores the rest in memory, then sends them sequentially as the port becomes available. This buffering logic is an essential update to the basic switch forwarding logic. The buffering delay is minimal in practice, with three 1250-byte frames taking only 3 milliseconds to transmit over 10 Mbps Ethernet. Without buffering, simultaneous forwarding to the same port would cause collisions, making the network dramatically slower. Understanding this mechanism is critical for analyzing switch performance and network capacity planning.
π§ Quick Revision Questions
- What does a switch do when it receives a frame?
- What problem arises when multiple frames need to be forwarded to the same destination port simultaneously?
- What mechanism does a switch use to avoid collisions in such a scenario?
- How is buffering delay calculated, and give an example with 1250-byte frames at 10 Mbps?
- Calculate the total time to send three 1500-byte frames over a switch at 10 Mbps to the same destination (show all steps).
π Lecture 22 β Full Duplex and Full Switching
π Overview: This lecture explains the concepts of full duplex and full switching in modern LANs, contrasting them with traditional half-duplex CSMA/CD operation. It demonstrates how switches enable simultaneous sending and receiving, eliminating collisions and improving network performance.
ποΈ Topics Covered
This lecture covers the limitations of CSMA/CD when used with switches, introduces the concept of full duplex operation where devices can send and receive simultaneously, explains the difference between half duplex and full duplex, and describes how full switching creates multiple virtual paths between devices.
π Lecture Summary
Full Duplex and Full Switching
This topic presents concepts of full duplex and full switching. With CSMA/CD, if an NIC is not receiving a frame, it can send. The switch avoids collisions by buffering the frame if the output port is busy. In a scenario where Fred sends a frame to Barney, and Barney wants to send a frame to Fred, Barney's CSMA/CD logic forces him to wait before sending. However, physically there is a single cable between Barney and the switch, with separate wire pairs for sending (pins 1 and 2) and receiving (pins 3 and 6). The switch will buffer any frames if pins 3 and 6 are busy, meaning there is truly no danger of a collision.
π‘ Why this matters: The physical separation of send and receive wire pairs in Ethernet cables means collisions are impossible when using a switch, making CSMA/CD's "listen before sending" rule unnecessary and limiting performance.
Barney can send and receive at the same instant in time as receiving the frame from Fred. This ability is called full duplex. The CSMA/CD imposes restriction of only sending or only receiving at one point in time; this is called half duplex. With switches and full duplex enabled, the LAN works like having a two-lane road between the switch and each device, plus another two-lane road between each port on the switch.
π Definition β Full Duplex: The ability to send and receive data simultaneously, enabled by separate wire pairs for transmission and reception. π Definition β Half Duplex: The restriction of only sending or only receiving at one point in time, imposed by CSMA/CD logic.
π Example: In Figure 22.3, Fred sends a frame to Barney while simultaneously Barney sends a frame to Fred. With full duplex, both transmissions occur at the same instant without collision, whereas with half duplex CSMA/CD, Barney would have to wait until Fred's frame finishes arriving before starting his own transmission.
β Key Takeaways
Full duplex operation is made possible by the physical separation of send and receive wire pairs in Ethernet cables (pins 1&2 for transmit, pins 3&6 for receive). Switches inherently prevent collisions by buffering frames when output ports are busy, eliminating the need for CSMA/CD's collision detection logic. Half duplex is the traditional CSMA/CD mode where a device can only send OR receive at any given time. Full duplex allows simultaneous sending and receiving, effectively doubling potential throughput. When combined with full switching, the LAN behaves like dedicated two-lane roads between every pair of communicating devices, completely eliminating collisions and maximizing performance.
π§ Quick Revision Questions
- What is the fundamental difference between half duplex and full duplex operation?
- Why does CSMA/CD force Barney to wait before sending in the scenario described?
- What physically prevents collisions in a full duplex Ethernet connection?
- How does a switch's buffering capability contribute to full duplex operation?
- What is the "two-lane road" analogy describing in the context of full switching?