4.3.7Computer Networks

Switching — circuit, packet, virtual circuit

2,548 words12 min readdifficulty · medium

WHAT is switching?

The whole subject splits along two questions:

  1. Is a dedicated path reserved in advance? (resource reservation)
  2. Does each switch keep per-connection state?
Path reserved? Per-connection state? Decision time
Circuit switching Yes (whole bandwidth) Yes Before data (setup)
Packet switching (datagram) No No Per packet, on the fly
Virtual circuit Logical path, not bandwidth Yes (VC table) Setup, then forward by label

1. Circuit Switching

HOW it works

  • Setup: a request propagates hop-by-hop; each switch reserves a channel (e.g., a time slot in TDM or a frequency band in FDM) and links input↔output.
  • Transfer: data flows with no per-hop header processing — the path is hardwired.
  • Teardown: resources are released.

Deriving the total delay

Let:

  • SS = setup time (signaling to build the circuit),
  • dd = number of links (hops), tpt_p = propagation delay per link,
  • LL = message size (bits), RR = link rate (bits/s).

Once the circuit exists, the message streams continuously; it is not stored at each switch, so the bits flow like water in a pipe.

Tcircuit=Ssetup+dtppropagation along path+LRtransmission of messageT_{\text{circuit}} = \underbrace{S}_{\text{setup}} + \underbrace{d\,t_p}_{\text{propagation along path}} + \underbrace{\frac{L}{R}}_{\text{transmission of message}}

Why this form? After setup, the first bit travels across all dd links (cost dtpd\,t_p), and the source pushes all LL bits at rate RR (cost L/RL/R). There is no store-and-forward \Rightarrow no ×d\times d on the transmission term.


2. Packet Switching (Datagram)

HOW the table works: each router looks at the destination address and consults a forwarding/routing table → outgoing link. State is not per-connection; it's per-destination (global routes).

Deriving the delay (store-and-forward)

Send one message of LL bits split into nothing (single packet) across dd links, rate RR, propagation tpt_p per link.

Because each switch must receive the whole packet before sending it on, each of the dd links costs a transmission time L/RL/R, serially:

T1 packet=dLR+dtpT_{\text{1 packet}} = d\cdot\frac{L}{R} + d\,t_p

Why dL/Rd\cdot L/R? The packet is reborn at each hop — switch 1 finishes receiving (time L/RL/R) before pushing to switch 2, etc. This serial replay is the cost of store-and-forward.

Now the magic — pipelining with PP packets. Split LL into PP packets of size L/PL/P each (ignoring header). The first packet reaches the destination after dL/PRd\cdot\frac{L/P}{R} transmission, then the remaining P1P-1 packets stream behind it pipeline-style, one L/PR\frac{L/P}{R} apart:

TP packets=dL/PRfirst packet across+(P1)L/PRrest pipelined+dtp=(d+P1)PLR+dtpT_{\text{P packets}} = \underbrace{d\cdot\frac{L/P}{R}}_{\text{first packet across}} + \underbrace{(P-1)\cdot\frac{L/P}{R}}_{\text{rest pipelined}} + d\,t_p = \frac{(d+P-1)}{P}\cdot\frac{L}{R} + d\,t_p

Why pipelining helps: while link 2 carries packet 1, link 1 already carries packet 2. As PP grows, d+P1P1\frac{d+P-1}{P}\to 1, so transmission cost L/R\to L/R — the same as if there were a single hop! Smaller packets ⇒ more pipelining ⇒ lower delay (until headers dominate).

Figure — Switching — circuit, packet, virtual circuit

3. Virtual Circuit Switching

HOW label swapping works: at each hop the switch reads the incoming VC number, looks it up, swaps it for the outgoing number from its table, and forwards. The label is locally meaningful only.

Comparison summary

Feature Circuit Datagram Virtual Circuit
Setup phase Yes (reserve BW) No Yes (logical only)
Bandwidth reserved Yes No No
Per-packet address none full destination small VC label
Path fixed, dedicated varies per packet fixed, shared
Ordering guaranteed Yes No Yes
State in switch per-circuit per-destination route per-VC table
Header overhead low high low
Wastes BW if idle Yes No No



Recall Feynman: explain to a 12-year-old

Imagine sending toy cars to a friend across a city of crossroads. Circuit switching: you call ahead and policemen clear a whole private road just for your cars — fast and smooth, but the road sits empty while you decide which car to send, and nobody else can use it. Packet switching: you write your friend's full address on every car and just push them into normal traffic. They take whatever streets are open, maybe arrive jumbled — but the roads are shared so nothing is wasted. Virtual circuit: you first drive once to mark a route with little colored stickers at each crossroad. Then your cars just follow the stickers (cheap to read) and stay in order — but other people's cars still use the same roads.


Connections

  • Computer Networks
  • Routing Algorithms (datagram needs routing tables; VC needs setup signaling)
  • Multiplexing — TDM, FDM (how circuits reserve channels)
  • TCP — reliable ordered delivery (fixes datagram reordering)
  • MPLS / ATM (real virtual-circuit technologies)
  • Store-and-Forward and Network Delays
  • Queueing Delay

Flashcards

What are the three phases of circuit switching?
Setup, data transfer, teardown.
Why does circuit switching delay have only ONE L/RL/R term, not dL/Rd\cdot L/R?
After setup the path is a dedicated pipe — no store-and-forward, so the message transmits once and propagates; hops only add propagation dtpd\,t_p.
Datagram delay for 1 packet over dd links?
dLR+dtpd\cdot\frac{L}{R} + d\,t_p (store-and-forward replays L/RL/R at each hop).
Pipelined datagram delay for PP packets?
d+P1PLR+dtp\frac{d+P-1}{P}\cdot\frac{L}{R} + d\,t_p; as PP\to\infty transmission → L/RL/R.
Why do smaller packets reduce delay?
More packets ⇒ more pipelining overlap across links, so effective transmission approaches a single-hop L/RL/R (until header overhead dominates).
What does a switch carry in a datagram packet vs a VC packet?
Datagram: full destination address. VC: a small locally-meaningful label/VC number.
What is label swapping?
At each hop a switch maps (in link, in VC#) → (out link, out VC#) and replaces the label, forwarding by table lookup.
Does a virtual circuit reserve bandwidth?
No — it reserves a logical path and installs labels; bandwidth is still shared (statistically multiplexed).
Which switching methods preserve packet order?
Circuit and virtual circuit (single fixed path); datagram does not.
What state does each switch keep?
Circuit: per-circuit reservation. Datagram: per-destination routing table. VC: per-virtual-circuit table entry.
Two real technologies using virtual circuits?
ATM, Frame Relay, MPLS (any two).
When is circuit switching wasteful?
For bursty traffic — reserved bandwidth sits idle during silent periods, blocking others.

Concept Map

answers

answers

type 1

type 2

type 3

reserves

three phases

gives

no store-and-forward

motivated by

splits data into

forwards by

combines

combines

Switching

Is path reserved?

Per-connection state?

Circuit Switching

Packet Switching datagram

Virtual Circuit

Dedicated end-to-end path

Setup - Transfer - Teardown

T = S + d·tp + L/R

No xd on transmission

Bursty traffic

Independent packets

VC table label

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Switching ka matlab simple hai: network ek bada sheher hai jisme bahut saare crossroads (switches) hain, aur humein decide karna hai ki data ko kaunse raste se bheja jaaye. Iska teen tareeke hote hain. Circuit switching phone call jaisa hai — pehle pura raasta reserve kar lo (setup), phi aaram se baat karo, phir hang up (teardown). Iska fayda: ek hi baar transmission cost (L/RL/R) lagti hai kyunki har switch pe packet ruk-ruk ke store nahi hota. Nuksaan: bandwidth reserve rehti hai, aur agar tum chup ho to wo waste ho rahi hai.

Packet switching (datagram) mein data ko chhote tukdo (packets) mein todte hain, har packet pe poora destination address likha hota hai, aur har packet alag-alag raste se ja sakta hai. Problem ye hai ki har hop pe "store-and-forward" hota hai — switch pura packet receive karke phir aage bhejta hai, isliye 1 packet ka delay dL/Rd\cdot L/R ban jaata hai. Lekin trick ye hai: agar bahut saare chhote packets bhejo to pipelining hoti hai — jab link 2 pe packet 1 chal raha hota hai, link 1 pe packet 2 already chal raha hota hai. Isse effective transmission ghatkar lagbhag L/RL/R reh jaati hai. Yahi reason hai ki internet packet switching use karta hai.

Virtual circuit dono ka mix hai — best of both worlds. Pehle ek baar setup karke har switch mein chhota sa label (VC number) install kar dete hain. Phir packets sirf label dekhke forward hote hain (full address nahi chahiye), aur sabhi ek hi raste se in-order jaate hain. Important baat: VC mein bandwidth reserve nahi hoti — sirf logical path fix hota hai. ATM, Frame Relay, MPLS isi pe based hain.

Yaad rakhne ka mantra: Call = Circuit, Mail = Packet, Tour = Virtual Circuit. Exam mein delay formulas ko ratne ki jagah unka why samjho — circuit mein store-and-forward nahi hota isliye sirf ek L/RL/R; datagram mein hota hai isliye dL/Rd\cdot L/R; aur pipelining se d+P1PLR\frac{d+P-1}{P}\cdot\frac{L}{R}.

Go deeper — visual, from zero

Test yourself — Computer Networks