Interview Prep Zoneby CuriouserLabs

Question 1 of 5 · senior level

Explain Amdahl's law. How do you actually use it when deciding whether to parallelize or scale?

🎤 Say this first

Speedup = 1 / ((1−p) + p/n): if fraction p of the work parallelizes across n workers, the serial remainder (1−p) caps you forever — 95% parallel code maxes at 20× no matter how many cores you add. Use it as a ceiling calculator before spending: measure the serial fraction (profiler, not vibes), compute the best case, compare to the cost. Its optimistic cousin Gustafson answers 'what if we grow the problem instead' (scale-out systems live here); its pessimistic cousin — coordination cost that grows with n (locks, coherence, consensus) — means real systems don't plateau, they retrograde. The law generalizes beyond CPUs: the serial fraction of your organization (that one approval step, that single-writer database) caps throughput identically.

The full picture

  • Worked example to have ready: request does 20ms serial (parsing, single-row txn) + 80ms parallelizable enrichment. Infinite cores → 20ms floor: 5× max, and 8 cores already gets 4.2× — 'buy 64 cores' is provably wasted money. Two lines of arithmetic that kill a bad architecture proposal.
  • The hidden serial fractions people miss: lock-protected sections, GC safepoints (all threads paused = p drops), the coordinator in scatter-gather (fan-out is parallel, merge is serial), schema migrations, and — at org scale — code review bottlenecks. Naming non-obvious (1−p) sources is where the question gets senior.
  • Universal Scalability Law is the honest upgrade: adds a coherence term (β·n(n−1)) for pairwise coordination — predicting the downturn you actually observe when 32 threads beat 64 on a contended structure. Mention it, sketch why crosstalk grows quadratically, cite your own retrograde-scaling war story.
  • Gustafson's reframe matters for scale-out: fixed problem → Amdahl's ceiling; growing problem (more users, more data) → efficiency stays high because parallel work grows while serial stays flat — the theoretical backbone of 'shard it' as a strategy.

🔄 Likely follow-up questions

  • Where's the serial fraction in a typical microservice request path?
  • Explain retrograde scaling with the USL — what does the β term physically represent?
  • How does Amdahl thinking apply to cache hit rates and CDN strategy?