Data CommunicationUnit 713 min read
Switching Techniques & Network Architectures: Circuits, Packets, Virtual Circuits, and Topologies
Unit 7 of Data Communication: Explores how data moves through networks via circuit switching, packet switching, and virtual circuits, compares architectures (star, mesh, ring), and explains ARQ protocols with real-world examples like NTC’s call routing and Daraz’s order processing.
TAKEAWAYS:
- Circuit switching reserves a dedicated path (like a phone call) but wastes bandwidth if idle; packet switching shares resources dynamically (like email or WhatsApp messages).
- Virtual circuits (e.g., VoIP calls) mimic circuit switching with logical paths; datagram networks (e.g., HTTP requests) treat each packet independently.
- Stop-and-wait ARQ retransmits damaged frames but stalls; Go-Back-N ARQ allows buffered retransmissions for efficiency.
- Network topologies (star, mesh, ring) determine reliability, cost, and scalability—e.g., NTC’s mesh backbone vs. Pathao’s star-based dispatch system.
- Hybrid switching (e.g., ATM) blends circuit and packet switching for real-time and best-effort traffic.
- Exam focus: Compare switching techniques, explain ARQ protocols with diagrams, and relate topologies to real services (e.g., NEPSE’s mesh for stock trading).
1. Switching Techniques: Circuit vs. Packet vs. Message Switching
Switching determines how data travels through a network. The three core methods are:
1.1 Circuit Switching
Definition: A dedicated end-to-end path is established (e.g., a phone call) before data transmission. Resources (bandwidth, nodes) are reserved for the duration.
How it works:
sequenceDiagram
participant Caller as Caller
participant Switch1 as Switch 1
participant Switch2 as Switch 2
participant Receiver as Receiver
Caller->>Switch1: SETUP (e.g., "Route call to +977-1-2345678")
Switch1->>Switch2: Allocate path (e.g., "Path A-B-C-D")
Switch2->>Receiver: Connect
Note over Caller,Receiver: Data flows ONLY on this path
Caller->>Switch1: Voice/data stream
Switch1->>Switch2: Forwarded directly
Switch2->>Receiver: Delivered in real-time
Caller->>Switch1: TEARDOWN (hang up)Real-world example:
- NTC/Ncell landline calls: A physical circuit (e.g., copper wires or microwave links) is reserved for the call’s duration. If you’re on a call, no one else can use that path.
- Analogy: Like renting a private train track for your journey—no one else can use it until you’re done.
Advantages:
- Guaranteed bandwidth and delay (critical for voice/video).
- No packet reordering or loss (real-time performance).
Disadvantages:
- Wastes bandwidth if the connection is idle (e.g., a silent phone call).
- Slow to establish (setup delay).
- Inflexible (path cannot change mid-call).
1.2 Packet Switching
Definition: Data is divided into packets (small chunks with headers), each routed independently through the network. Packets may take different paths and arrive out of order.
How it works:
sequenceDiagram
participant HostA as Host A
participant Router1 as Router 1
participant Router2 as Router 2
participant HostB as Host B
HostA->>Router1: Packet 1 (e.g., "Hello")
HostA->>Router1: Packet 2 (e.g., "World")
Router1->>Router2: Packet 1 (via Path X)
Router1->>Router2: Packet 2 (via Path Y)
Router2->>HostB: Packet 1 arrives first
Router2->>HostB: Packet 2 arrives later
HostB->>HostB: Reassembles: "Hello World"Real-world example:
- WhatsApp messages: Your text is split into packets, routed through servers (e.g., WhatsApp’s global backbone), and reassembled on the recipient’s phone. If one packet is lost, it’s retransmitted.
- Daraz order processing: Your order is broken into packets (e.g., "Item A," "Item B") sent to different warehouses. The system reassembles them at the delivery center.
Advantages:
- Efficient bandwidth use (shared resources).
- Flexible routing (avoids congestion).
- Supports bursty traffic (e.g., emails, web browsing).
Disadvantages:
- Packets may be lost, corrupted, or delayed.
- Requires buffering and reassembly at the destination.
1.3 Message Switching
Definition: Entire messages (not packets) are stored and forwarded by intermediate nodes. Rarely used today but historically important (e.g., early email systems).
Key difference from packet switching:
- Message switching: Waits for the entire message before forwarding.
- Packet switching: Forwards individual packets as soon as they arrive.
Why it’s obsolete:
- High latency (messages can sit for hours in queues).
- Inefficient for real-time data.
2. Virtual Circuit vs. Datagram Networks
Both packet-switching architectures, but with different guarantees:
| Feature | Virtual Circuit (VC) | Datagram Network |
|---|---|---|
| Path Setup | Logical path established (e.g., via signaling). | No path setup; each packet routed independently. |
| Header | Includes VC identifier (e.g., "Call ID 123"). | Includes destination IP (e.g., "192.168.1.1"). |
| Reliability | Guaranteed delivery order (like circuit switching). | No order guarantee; packets may arrive out of order. |
| Example | VoIP calls (e.g., WhatsApp Voice), ATM networks. | HTTP requests, UDP (e.g., video streaming). |
| Real-world Use | NEPSE stock trading (ordered transactions). | YouTube video chunks (order doesn’t matter). |
Virtual Circuit Example: VoIP Call
sequenceDiagram
participant PhoneA as Phone A
participant VoIP_Server as VoIP Server
participant PhoneB as Phone B
PhoneA->>VoIP_Server: SETUP (e.g., "Establish VC for +977-9812345678")
VoIP_Server->>PhoneB: Ring
PhoneB->>VoIP_Server: ANSWER (creates VC ID "VC-456")
Note over PhoneA,PhoneB: Now, packets use VC-456 header
PhoneA->>VoIP_Server: Packet 1 (VC-456)
VoIP_Server->>PhoneB: Packet 1 (VC-456)
PhoneA->>VoIP_Server: Packet 2 (VC-456)
VoIP_Server->>PhoneB: Packet 2 (VC-456)Datagram Example: HTTP Request
sequenceDiagram
participant Browser as Browser
participant Router1 as Router 1
participant Server as Google Server
Browser->>Router1: HTTP GET (datagram, no VC)
Router1->>Server: Packet 1 (IP: 8.8.8.8)
Router1->>Server: Packet 2 (IP: 8.8.8.8)
Server->>Router1: Response Packet 1
Server->>Router1: Response Packet 2
Note over Browser,Server: Packets arrive out of order; TCP reassembles.3. ARQ Protocols: Error Control in Packet Switching
Since packets can be lost or corrupted, Automatic Repeat reQuest (ARQ) protocols ensure reliability. Two key types:
3.1 Stop-and-Wait ARQ
Mechanism:
- Sender sends one packet and waits for an ACK (acknowledgment).
- If no ACK arrives within a timeout, the packet is retransmitted.
- Receiver sends ACK only if the packet is correct.
Example Trace:
sequenceDiagram
participant Sender as Sender
participant Receiver as Receiver
Sender->>Receiver: Packet 1 (e.g., "Hello")
alt Packet lost
Receiver->>Sender: No ACK (timeout)
Sender->>Receiver: Retransmit Packet 1
else Packet arrives
Receiver->>Sender: ACK 1
endWhen retransmission is necessary:
- Packet loss: Due to network congestion or hardware failure.
- Corruption: Bit errors during transmission (e.g., due to noise).
- Timeout: No ACK received within the expected time.
Advantages:
- Simple to implement.
- Guarantees delivery (if no errors).
Disadvantages:
- Low efficiency: Sender stalls waiting for ACK (wastes bandwidth).
- High delay: Not suitable for high-speed links.
3.2 Go-Back-N ARQ
Mechanism:
- Sender sends multiple packets (window size N) without waiting for ACKs.
- If an ACK for packet k is missing, all packets from k onward are retransmitted (go back to k).
- Receiver buffers packets and discards duplicates.
Example Trace:
sequenceDiagram
participant Sender as Sender
participant Receiver as Receiver
Sender->>Receiver: Packet 1
Sender->>Receiver: Packet 2
Sender->>Receiver: Packet 3
alt Packet 2 lost
Receiver->>Sender: ACK 1 (ACK 2 missing)
Sender->>Receiver: Retransmit Packet 2, 3, 4...
else All packets arrive
Receiver->>Sender: ACK 3
endAdvantages:
- Higher throughput: Sender doesn’t stall after every packet.
- Works well for bursty traffic (e.g., file transfers).
Disadvantages:
- Wastes bandwidth: Retransmits multiple packets for a single error.
- Receiver buffering required.
3.3 Selective Repeat ARQ
Mechanism:
- Like Go-Back-N, but only retransmits the lost/corrupted packet (not all subsequent ones).
- Requires sequence numbers to identify lost packets.
- More complex but efficient for high-speed links.
Example: If Packet 5 is lost, only Packet 5 is retransmitted (Packets 6–10 proceed).
4. Network Architectures: Topologies
The physical or logical layout of interconnected nodes affects performance, cost, and reliability.
4.1 Star Topology
Description: All nodes connect to a central hub (e.g., router or switch). Example:
- Pathao dispatch system: All drivers connect to a central server for task assignment.
- NTC’s cell tower network: Mobile phones connect to a central base station.
Advantages:
- Easy to add/remove nodes.
- Fault isolation (if one node fails, others aren’t affected).
- Centralized management.
Disadvantages:
- Single point of failure (hub).
- High cost if many nodes.
4.2 Mesh Topology
Description: Every node connects to multiple other nodes (full mesh) or a subset (partial mesh). Example:
- NEPSE stock exchange: Brokers are interconnected to ensure redundancy.
- NTC’s microwave backbone: Towers are linked in a mesh for failover paths.
Advantages:
- High redundancy: Multiple paths if one link fails.
- Scalable for large networks.
Disadvantages:
- High cost (many cables/links).
- Complex routing.
4.3 Ring Topology
Description: Nodes are connected in a closed loop; data travels in one direction. Example:
- Token Ring networks (legacy, but used in some industrial systems).
- Fiber Distributed Data Interface (FDDI) for campus networks.
Advantages:
- Simple to implement.
- Predictable delay (data moves in one direction).
Disadvantages:
- Single point of failure (if the ring breaks, the network fails).
- Difficult to add nodes.
4.4 Hybrid Topologies
Example: Combining star and mesh for scalability.
- Google’s data centers: Use a hybrid of star (racks to switches) and mesh (switches to switches) for efficiency.
5. Hybrid Switching: ATM (Asynchronous Transfer Mode)
Definition: Blends circuit switching (for real-time traffic) and packet switching (for data).
- Uses fixed-size cells (53 bytes) instead of variable-length packets.
- Virtual circuits for voice/video; datagram mode for data.
Example:
- VoIP calls use ATM’s circuit-like guarantees.
- File downloads use ATM’s packet-switching flexibility.
In the Real World
NTC’s Call Routing (Circuit Switching)
- Your landline call uses circuit switching to reserve a dedicated path through microwave towers and fiber cables. If the path fails (e.g., a tower goes down), the call drops—just like in the old phone networks.
Daraz Order Processing (Packet Switching + Virtual Circuits)
- When you order groceries, your request is split into packets (e.g., "Item A: 2 kg rice," "Item B: 1 kg sugar"). These packets are routed to different warehouses (like datagram packets). However, once your order is confirmed, Daraz may use a virtual circuit to track its progress in real-time (e.g., "Your order is being packed").
WhatsApp Voice Calls (Virtual Circuit)
- Your voice data is split into packets, but WhatsApp establishes a virtual circuit (like a logical phone line) to ensure packets arrive in order. This mimics circuit switching’s reliability without reserving a physical path.
NEPSE Stock Trading (Mesh Topology + Virtual Circuits)
- NEPSE’s trading system uses a mesh topology to connect brokers redundantly. Each trade is sent as a packet, but the system uses virtual circuits to ensure trades are processed in the correct order (e.g., "Buy 100 shares of ABC at 500" must arrive before "Sell 50 shares of ABC at 501").
Exam Tip
- Compare switching techniques with a table (like the one above) and relate to real examples (e.g., "NTC uses circuit switching for calls, while WhatsApp uses packet switching for messages").
- Draw ARQ protocols (stop-and-wait, Go-Back-N) with sequence diagrams. Show retransmission scenarios (e.g., "If Packet 3 is lost, what happens in Go-Back-N?").
- Explain topologies with labeled diagrams. For example:
- "In a star topology, if the central switch fails, all nodes are disconnected. This is why Pathao uses a hybrid topology to avoid single points of failure."
- For virtual circuits vs. datagrams:
- "Virtual circuits guarantee order (like a phone call), while datagrams do not (like email). NEPSE uses virtual circuits for trades to prevent order conflicts."
- Worked example:
- "If a bit stream
10011101is transmitted using CRC-16, calculate the checksum and show how errors are detected. Assume a corrupted bit10011111arrives. How does CRC help?" Solution:- CRC-16 divides the data by
x^16 + x^12 + x^5 + 1to get a remainder (checksum). - The sender appends the checksum; the receiver checks if the remainder is zero. If not, an error is detected.
- For
10011101, the checksum is1100000000000001. If10011111arrives, the CRC check fails, triggering retransmission.
- CRC-16 divides the data by
- "If a bit stream
Key formula to remember:
- CRC remainder = Divide
(data || 000...0)by the CRC polynomial (e.g.,x^16 + x^12 + x^5 + 1) to get the checksum.
Based on the PU BE Computer (PU) syllabus for Data Communication, unit 7.
Discussion
Loading…