---
title: Problem set 11
heading: "Problem set 11: designing computer systems"
eyebrow: S4 · Problem set 11
type: problems
---

::: hook
These problems size systems from requirements, the way an architect answers "how many, how big, how fast": cores for a request rate, bandwidth and cache for a working set, power and frequency for a budget, servers for a latency target, replicas for an availability target. Round counts up.
:::

::: pool
pick: 12

::: check
kind: parts
given: Q = 10000 | 50000; I = 5 | 20; c = 0.8 | 1.5; f = 2.5 | 3.5

## A service handles {Q} requests a second, each executing {I} million instructions at a CPI of {c} on {f} GHz cores.

::: part
answer: Q*I*1e6*c/(f*1e9)
unit: cores
tolerance: 0.5%

### How many cores does it keep busy?

::: misses
- [any] Instructions per second × CPI ÷ clock.
:::
:::

::: part
answer: ceil(Q*I*1e6*c/(f*1e9)/0.6 - 1e-9)
unit: cores
tolerance: 0

### How many cores should it get to run at 60% utilization?

::: misses
- [any] Round up the busy cores over 0.6.
:::
:::
:::

::: check
kind: parts
given: m = 0.05 | 0.1; S = 2 | 8; t = 0.01 | 0.02

## A program misses {m} in a {S} MB cache. By the √2 rule, how big must the cache be to bring that to {t}?

::: part
answer: S*(m/t)^2
unit: MB
tolerance: 0.5%

### What size does it need?

::: misses
- [S*m/t] The miss rate falls only as the square root of size.
- [any] $S(m/t)^2$.
:::
:::
:::

::: check
kind: parts
given: P = 100 | 150; f = 3 | 3.5; Q = 80 | 200

## A chip runs at {f} GHz on {P} W with voltage tracking frequency (power ∝ $f^3$).

::: part
answer: f*(Q/P)^(1/3)
unit: GHz
tolerance: 0.5%

### What clock does a {Q} W budget allow?

::: misses
- [f*Q/P] Power goes as the cube of frequency.
- [any] $f(Q/P)^{1/3}$.
:::
:::
:::

::: check
kind: parts
given: Q = 5000 | 20000; S = 2 | 5; T = 10 | 25

## Requests arrive at {Q} a second and each takes {S} ms of a server's time (M/M/1 per server). The mean response time must stay under {T} ms.

::: part
answer: 1 - S/T
tolerance: 0.5%

### What is the highest utilization each server can run at?

::: misses
- [any] Solve $S/(1 - \rho) = T$.
:::
:::

::: part
answer: ceil(Q*S/1000/(1 - S/T) - 1e-9)
unit: servers
tolerance: 0

### How many servers are needed?

::: misses
- [ceil(Q*S/1000 - 1e-9)] Running at 100% would make the latency unbounded.
- [any] Total work over the allowed utilization, rounded up.
:::
:::
:::

::: check
kind: parts
given: M = 64 | 256 | 1024; u = 0.5 | 0.8 | 0.9; n = 128 | 256

## A weight-stationary {n} × {n} array should reach {u} utilization on single-tile passes (n to load, M + 2(n − 1) to stream).

::: part
answer: u*(3*n - 2)/(1 - u)
unit: rows
tolerance: 0.5%

### What batch M does that need?

::: misses
- [any] Solve $M/(M + 3n - 2) = u$.
:::
:::
:::

::: check
kind: parts
given: B = 200 | 800; R = 4800 | 6400

## A system needs {B} GB/s of memory bandwidth, from 8-byte channels at {R} MT/s run at 70% of peak.

::: part
answer: ceil(B/(R*8/1000*0.7) - 1e-9)
unit: channels
tolerance: 0

### How many channels does it need?

::: misses
- [any] Required over sustained per channel.
:::
:::
:::

::: check
kind: parts
given: I = 10000 | 100000 | 1000000; d = 150 | 200; s = 100000 | 500000

## A database needs {I} random reads a second. A disk does {d}; an SSD does {s}.

::: part
answer: ceil(I/d - 1e-9)
unit: disks
tolerance: 0

### How many disks would it need?

::: misses
- [any] IOPS over per-disk IOPS.
:::
:::

::: part
answer: ceil(I/s - 1e-9)
unit: SSDs
tolerance: 0

### How many SSDs?

::: misses
- [any] IOPS over per-SSD IOPS.
:::
:::
:::

::: check
kind: parts
given: a = 0.99 | 0.999; t = 4 | 5

## Replicas are each available {a} of the time, independently; the service needs at least one, and must be down at most $10^{-t}$ of the time (t = {t}).

::: part
answer: ceil(t/(-log(1 - a)) - 1e-9)
unit: replicas
tolerance: 0

### How many replicas does it need?

::: misses
- [any] Smallest k with $(1 - a)^k \le 10^{-t}$.
:::
:::
:::

::: check
kind: parts
given: N = 64 | 256 | 1024; r = 1 | 4; s = 25 | 100

## {N} nodes exchange data all-to-all, each sending {r} GB/s spread evenly over the others; links carry {s} GB/s.

::: part
answer: N*r/2
unit: GB/s
tolerance: 0.5%

### How much traffic crosses the network's bisection, in both directions together?

::: misses
- [any] Half of each node's traffic crosses, from all N nodes.
:::
:::

::: part
answer: ceil(N*r/2/s - 1e-9)
unit: links
tolerance: 0

### How many bisection links does that need?

::: misses
- [any] Bisection traffic over link bandwidth.
:::
:::
:::

::: check
kind: parts
given: P = 200 | 400; Q = 500 | 5000; E = 1.1 | 1.5

## A server draws {P} W and answers {Q} queries a second, in a facility with PUE {E}.

::: part
answer: P*E/Q
unit: J
tolerance: 0.5%

### How much energy does each query cost?

::: misses
- [P/Q] Include the facility overhead.
- [any] Power × PUE ÷ query rate.
:::
:::
:::

::: check
kind: parts
given: c = 4000 | 10000; y = 4 | 5; P = 300 | 600; E = 1.2 | 1.6; e = 50 | 150

## A server costs {c} dollars and lasts {y} years; it draws {P} W on average in a facility with PUE {E}, at {e} dollars per MWh.

::: part
answer: P*E*8760*y/1e6*e
tolerance: 0.5%

### What does its electricity cost over its life, in dollars?

::: misses
- [any] Power × PUE × hours × price.
:::
:::

::: part
answer: P*E*8760*y/1e6*e/(c + P*E*8760*y/1e6*e)*100
unit: %
tolerance: 0.5%

### What share of the server's total cost is electricity?

::: misses
- [any] Energy cost over purchase plus energy.
:::
:::
:::

::: check
kind: parts
given: B = 1000 | 4000 | 10000; p = 0.05 | 0.1 | 0.2

## A predictor table is shared by {B} active branches; the chance a given branch aliases must stay under {p}.

::: part
answer: ceil(log(-(B - 1)/ln(1 - p))/log(2) - 1e-9)
unit: bits
tolerance: 0

### How many index bits does the table need (using $1 - (1 - 2^{-n})^{B-1} \approx 1 - e^{-(B-1)/2^n}$)?

::: misses
- [any] Solve $e^{-(B-1)/2^n} \ge 1 - p$ for n.
:::
:::
:::

::: check
kind: parts
given: t = 80 | 120; o = 3 | 4; d = 15 | 20; g = 3 | 4

## An instruction path of {t} FO4 must run at {g} GHz in a process whose FO4 delay is {d} ps; each stage adds {o} FO4 of overhead.

::: part
answer: 1000/(g*d)
unit: FO4
tolerance: 0.5%

### How many FO4 does each cycle allow?

::: misses
- [any] Period over FO4 delay.
:::
:::

::: part
answer: ceil(t/(1000/(g*d) - o) - 1e-9)
unit: stages
tolerance: 0

### How many stages does it need?

::: misses
- [any] Logic over the logic per stage, rounded up.
:::
:::
:::

::: check
kind: parts
given: G = 1 | 10; e = 0.5 | 2; M = 50 | 500; x = 20 | 100; Q = 100 | 1000

## An inference runs {G} G multiply-accumulates at {e} pJ each and moves {M} MB at {x} pJ per byte; the service runs {Q} inferences a second.

::: part
answer: (G*1e9*e + M*1e6*x)*1e-12
unit: J
tolerance: 0.5%

### How much energy does each inference take?

::: misses
- [any] Arithmetic plus data movement.
:::
:::

::: part
answer: (G*1e9*e + M*1e6*x)*1e-12*Q
unit: W
tolerance: 0.5%

### What power does the service draw for it?

::: misses
- [any] Energy per inference × rate.
:::
:::
:::
:::
