4.3.7 · D4Computer Networks

Exercises — Switching — circuit, packet, virtual circuit

2,293 words10 min readBack to topic

This page is a self-testing ladder for Switching — circuit, packet, virtual circuit. Work each problem before opening its solution. Every symbol used here was defined in the parent note; a quick reminder table sits below so you never have to guess.

Recall The symbols we reuse (open only if you forgot)
  • ::: message size in bits
  • ::: link rate in bits per second (bps)
  • ::: number of links (hops) on the path
  • ::: propagation delay per link (seconds)
  • ::: circuit setup time (seconds)
  • ::: number of packets we split into
  • ::: transmission time — how long to push all bits onto one link

Level 1 — Recognition

Exercise 1.1

For each network below, name the switching type: (a) a landline phone call reserving a path end-to-end, (b) web packets each carrying a full IP destination address forwarded independently, (c) MPLS forwarding by swapping small labels along a pre-set path.

Recall Solution

WHAT we do: match each description to the defining property.

  • (a) A reserved end-to-end path used exclusively → circuit switching.
  • (b) Each unit carries a full destination address and is forwarded independentlypacket (datagram) switching.
  • (c) A pre-set path plus label swapping with no bandwidth reserved → virtual circuit switching.

WHY: the three types differ by when the path is chosen and what each packet carries. "Full address per packet" is the datagram fingerprint; "small label + fixed path" is the VC fingerprint.

Exercise 1.2

True or false, with one-line reason each: (a) Circuit switching keeps per-connection state in switches. (b) Datagram switching guarantees in-order delivery. (c) A virtual circuit reserves the full link bandwidth.

Recall Solution
  • (a) True. A reserved circuit is per-connection state (the input↔output link binding).
  • (b) False. Datagram packets may take different paths and arrive out of order; ordering is the job of a higher layer like TCP.
  • (c) False. A VC reserves a logical path only; links are still shared, bandwidth is not dedicated.

Level 2 — Application

Exercise 2.1

A single packet of bits crosses links at rate bps with propagation ms per link, using datagram store-and-forward. Find the total delay.

Recall Solution

WHAT / WHY: one packet, store-and-forward ⇒ each of the links must fully receive then resend, so transmission time appears once per hop.

Exercise 2.2

Same message and path as 2.1, but sent as a circuit with setup ms. Find the delay and explain the difference from 2.1.

Recall Solution

WHAT / WHY: after setup the path is a continuous pipe — no store-and-forward — so appears only once. Difference: datagram cost s because each hop replayed all Mbit serially ( s). Circuit paid a one-time ms setup but transmits once, so it is nearly 4× faster for this single big packet.


Level 3 — Analysis

Exercise 3.1

Take bits, bps, hops, ms. Compute datagram delay for packet and for packets (ignore headers). By how much does pipelining cut the delay?

Recall Solution

Reference the pipeline picture:

Figure — Switching — circuit, packet, virtual circuit
WHAT / WHY: splitting into packets lets link 2 carry packet 1 while link 1 already carries packet 2 — parallel use of links. : : Saving: s — roughly 5× faster, because as grows, driving transmission cost toward a single .

Exercise 3.2

For the numbers in 3.1, what value of makes the effective transmission factor equal to exactly ? What does this tell you about diminishing returns?

Recall Solution

WHAT: solve with . WHY it matters: at we are already within of the ideal single-hop transmission. Doubling again to only pushes the factor from to — a tiny gain. The curve flattens, and in reality every packet also carries a header, so past a point more packets = more header overhead = slower. Pipelining has a sweet spot, not "infinitely small is best."


Level 4 — Synthesis

Exercise 4.1

Compare all three schemes for one file: bits, bps, hops, ms, circuit setup ms. Split into packets for the pipelined datagram case. Rank them fastest→slowest and explain the ranking.

Recall Solution

, .

  • Circuit:
  • Datagram, 1 packet:
  • Datagram, 500 packets:

Ranking (fastest first): pipelined datagram () < circuit () < single-packet datagram (). WHY: pipelined datagram gets transmission down to ≈ and pays no ms setup, so it edges out circuit. Single-packet datagram is crippled by store-and-forward replaying all Mbit on each of hops. This is precisely why the modern internet is packet-switched — see how it beats the reserved circuit.

Exercise 4.2

Along a virtual circuit A→B, the VC tables are:

  • Switch S1: (in port 1, VC 7) → (out port 2, VC 3)
  • Switch S2: (in port 5, VC 3) → (out port 4, VC 9)

A sends a packet labeled 7. Trace the label at each hop and state what B ultimately receives. Then explain why S1 and S2 can both freely reuse small numbers.

Recall Solution

Trace (label swapping):

  1. A → S1 with label 7. S1 looks up (port 1, VC 7) → outputs on port 2 with label 3.
  2. S1 → S2 with label 3. S2 looks up (port 5, VC 3) → outputs on port 4 with label 9.
  3. S2 → B with label 9.

WHY reuse works: each label is locally meaningful only — VC 3 at S1's output means nothing to any other switch. A globally unique number would force coordination across the whole network; local swapping lets every switch manage its own small label space independently. This is the trick behind ATM and MPLS.


Level 5 — Mastery

Exercise 5.1

A datagram network sends bits over hops, bps, ms, but each packet now carries a header of bits. If we split into packets, the total bits transmitted per hop are and each packet has size . The pipelined delay becomes Compute for and , and say which is better — proving the L3 trap is real.

Recall Solution

Reference the overhead curve:

Figure — Switching — circuit, packet, virtual circuit
.

: packet size bits.

: packet size bits.

Verdict: ( s) beats ( s). With headers present, splitting too finely adds header bits, which more than cancels the pipelining gain. This proves the L3 warning: there is a finite optimal , not "smaller is always better."

Exercise 5.2

Design decision: a provider carries bursty web traffic (short bursts, long idle gaps) and steady video calls (constant bitrate, needs strict ordering, low overhead). Recommend a switching type for each and justify using the trade-off table from the parent note.

Recall Solution

Bursty web → datagram packet switching. Bursty means links sit idle most of the time; reserving bandwidth (circuit / dedicated slots) would waste it. Datagram statistically multiplexes many bursty users onto shared links — no reservation, no idle waste. Out-of-order arrival is fine because TCP reorders. See Queueing Delay for the cost this shifts onto buffers. Steady video → virtual circuit. A call is constant-rate and needs ordered, low-overhead delivery. A VC gives a fixed path (ordering guaranteed), tiny labels (low header), and cheap label-swap forwarding — without wasting bandwidth on idle gaps (there aren't many). Pure circuit switching would also work but wastes bandwidth on any pause and needs full reservation; VC is the modern compromise (ATM / MPLS were built for exactly this). Route choice at setup is handled by Routing Algorithms.


Recall Quick self-check (cover the answers)

Circuit delay formula ::: Why no on transmission in circuit switching ::: no store-and-forward — the path is a continuous pipe after setup Pipelined datagram transmission factor as ::: What limits how far we shrink packets ::: per-packet header overhead What a VC label does at each switch ::: it is looked up and swapped (local lookup key, not an address)