← all topics

2 · Packet vs circuit switching ★

HW1 P1, P8 · Sample midterm P3

Circuit switching (the old phone network)

Packet switching (the Internet)

When is circuit switching the better choice? (HW1 P1)

For a steady, predictable rate over a long session. You reserve exactly what you need with no waste, and the setup cost is spread over the long session.
If the sum of all app rates is less than every link's capacity, you don't need congestion control, because queues never build up.

The formulas

Setup: link rate \(C\), each user needs \(r\) when active, each user is active with probability \(p\), \(N\) users total.

Circuit switching users:

$$\text{users} = \frac{C}{r}$$

Packet switching, probability that exactly \(k\) users are active:

$$P(k) = \binom{N}{k}\, p^k\, (1-p)^{N-k}$$

Probability of overflow (more than \(C/r\) active at once):

$$P(\text{overflow}) = 1 - \sum_{k=0}^{C/r} \binom{N}{k}\, p^k\, (1-p)^{N-k}$$

\(\binom{N}{k} = \dfrac{N!}{k!\,(N-k)!}\) is the number of ways to pick which \(k\) users are active (written C(N,k) or nCr).

Why it works: \(p^k\) = those \(k\) users are on. \((1-p)^{N-k}\) = everyone else is off. \(\binom{N}{k}\) = how many different groups of \(k\) users there are.
Watch the wording. "20 or more" → sum from \(k = 20\) up. "More than 20" or "exceeds capacity" → sum from \(k = 21\) up, which equals \(1 - \sum_{k=0}^{20}\).

Worked example 1: circuit switching timing

Q: How long does it take to send a 640,000-bit file from A to B over a circuit-switched network? Every link is 1.536 Mbps, each link uses TDM with 24 slots, and setting up the circuit takes 500 ms.

  1. Your circuit's rate. TDM gives you 1 of 24 slots, so you get 1/24 of the link: $$\frac{1{,}536{,}000}{24} = 64{,}000 \text{ bps} = 64 \text{ kbps}$$
  2. Time to push the file through. $$\frac{640{,}000 \text{ bits}}{64{,}000 \text{ bps}} = 10 \text{ s}$$
  3. Add setup. $$10 \text{ s} + 0.5 \text{ s} = \mathbf{10.5 \text{ s}}$$
Same answer with FDM with 24 bands: each band also gets 1/24 of the capacity. The circuit doesn't speed up just because the link is idle. That's the waste.

Worked example 2: small enough to do by hand

Q: 1 Mbps link. Each user needs 250 kbps when active and is active 20% of the time.

(a) How many users with circuit switching?

$$\frac{1000 \text{ kbps}}{250 \text{ kbps}} = \mathbf{4 \text{ users}}$$

(b) Packet switching with N = 5 users. P(exactly 2 active)?

\(N = 5,\ k = 2,\ p = 0.2,\ 1-p = 0.8\)

$$\binom{5}{2} = \frac{5!}{2!\,3!} = \frac{120}{2 \cdot 6} = 10$$ $$0.2^2 = 0.04 \qquad 0.8^{3} = 0.512 \quad (N-k = 5-2 = 3)$$ $$P(2) = 10 \times 0.04 \times 0.512 = \mathbf{0.2048} \quad (\text{about } 20\%)$$

(c) P(capacity is exceeded)?

Capacity is 4 users, so "exceeded" means more than 4 active. With 5 users that's only \(k = 5\):

$$P(5) = \binom{5}{5}\, 0.2^5\, 0.8^0 = 1 \times 0.00032 \times 1 = \mathbf{0.00032}$$

Same answer with the complement formula:

\(k\)\(\binom{5}{k}\)\(0.2^k \cdot 0.8^{5-k}\)\(P(k)\)
011 × 0.327680.32768
150.2 × 0.40960.4096
2100.04 × 0.5120.2048
3100.008 × 0.640.0512
450.0016 × 0.80.0064
\(\sum_{k=0}^{4}\)0.99968
$$P(\text{overflow}) = 1 - 0.99968 = \mathbf{0.00032} \ \checkmark$$
Takeaway: circuit switching fits 4 users. Packet switching fits 5 and overflows only 0.032% of the time.

Worked example 3: your homework-size problem

Q: 10 Mbps link. Each user needs 500 kbps when active, active 20% of the time.

  1. Circuit (convert units first: 10 Mbps = 10,000 kbps): $$\frac{10{,}000}{500} = \mathbf{20 \text{ users}}$$
  2. Packet, \(N = 50\), P(exactly \(k\)): $$P(k) = \binom{50}{k}\, 0.2^k\, 0.8^{50-k}$$ Example, \(k = 10\): $$\binom{50}{10}\, 0.2^{10}\, 0.8^{40} \approx 10{,}272{,}278{,}170 \times 1.024{\times}10^{-7} \times 1.329{\times}10^{-4} \approx \mathbf{0.140}$$
  3. P(capacity exceeded) = P(more than 20 active): $$1 - \sum_{k=0}^{20} \binom{50}{k}\, 0.2^k\, 0.8^{50-k} \approx 0.00032$$
On the exam, writing the formula with the right numbers and bounds is usually the answer (that's what the sample midterm expects). Nobody sums 21 terms by hand.
Takeaway: circuit = 20 users. Packet = 50 users (2.5×) with about a 0.03% chance of overflow.

Slide example (memorize the punchline)

1 Gbps link, 100 Mbps per user, active 10% of the time.

Your answers

1. Circuit-switching users ✓ 10,000 / 500 = 20 users.
2. P(exactly k active), N = 50 ✓ $$\binom{50}{k}\, (0.2)^k\, (0.8)^{50-k}$$
3. P(capacity exceeded) (you skipped this) $$1 - \sum_{k=0}^{20} \binom{50}{k} (0.2)^k (0.8)^{50-k} \;=\; \sum_{k=21}^{50} \binom{50}{k} (0.2)^k (0.8)^{50-k}$$ Capacity is 20, so "exceeded" starts at 21.
4. 2 Mbps video call for hours (you skipped this) Circuit switching. The rate is constant and the session is long, so you reserve exactly 2 Mbps with no waste, get a guaranteed rate with no queuing delay or jitter, and the setup cost is spread over hours.

Practice

A 2 Mbps link, each user needs 400 kbps when active, active 10% of the time, N = 6. (a) Circuit users? (b) P(exactly 1 active)? (c) P(capacity exceeded)? (a) $$\frac{2000}{400} = \mathbf{5 \text{ users}}$$ (b) $$\binom{6}{1}\, 0.1^1\, 0.9^5 = 6 \times 0.1 \times 0.59049 = \mathbf{0.354}$$ (c) More than 5 active means all 6: $$0.1^6 = \mathbf{0.000001}$$

← 1 · Internet basics · all topics · 3 · Delay →