Kayavak / Recaps / Specialization Depth
Recaps · Volume 17
Specialization Depth
The revision sheet of every chapter, on one page: the key ideas, the numbers worth knowing, the pitfalls and the words. Use it before an interview, after a chapter, or to find which chapter to reread. Each title opens its chapter; below each sheet are its exercises, companion and TiffinBox stage, and the misconceptions the companion corrects.
194A
Key ideas
- Six levels defined operationally: L1 recognition, L2 working, L3 internals, L4 debugging, L5 design, L6 production.
- Profiles: T-shaped (one deep area), π-shaped (two), with Part XVII's targets: L5/L6 on the track's core, L3/L4 breadth elsewhere.
- Self-assessment with evidence: artefacts, explanations, bug fixes, decision records, incidents; beware overconfidence at low levels and underconfidence at high ones.
- Deliberate practice: specific weaknesses, immediate feedback, stretch tasks.
- Retrieval practice and spacing: answer from memory, at growing intervals.
- Pathways between levels: L2 → L3 by reading source and specs; L3 → L4 by breaking and fixing; L4 → L5 by owning decisions; L5 → L6 by operating at scale.
Numbers to remember
- Lab: 5-question quizzes let a 65% learner pass an 80% bar 43% of the time; 40 questions, 3%.
- Lab: 6,192 quiz questions in Volumes 1–16.
- Model: 6 spaced reviews over 45 days → 0.43 recall at day 60; massed → ~0.
Pitfalls
- Equating time served with depth.
- Judging mastery from one short quiz.
- Re-reading instead of retrieving.
- Practising what you're already good at.
- Claiming L5/L6 without decisions or incidents to show.
Glossary
- Operational definition: defining a level by observable behaviour.
- Retrieval practice: recalling information to strengthen memory.
- Spaced repetition: reviewing at increasing intervals.
- Deliberate practice: focused, feedback-driven practice on weaknesses.
- Calibration: how well confidence matches actual performance.
194B
Key ideas
- Java Memory Model: happens-before via locks,
volatile, thread start/join, final fields; data races give stale or torn reads.
- JVM: class loading, JIT tiers (C1/C2), escape analysis, GC families (Serial, Parallel, G1, ZGC, Shenandoah), JFR and unified logging.
- Virtual threads: cheap blocking concurrency; watch pinning (pre-JDK 24
synchronized), ThreadLocal usage, and downstream limits like connection pools.
- L4 toolkit: thread dumps, heap dumps (MAT), JFR/JMC, async-profiler, GC logs,
jcmd.
- Spring: dependency injection, proxies (self-invocation trap), transaction propagation and isolation, lazy loading and N+1, MVC vs WebFlux vs virtual threads.
- L6: JVM upgrades, container-aware memory settings, startup time (CDS, AOT), observability, capacity and cost.
Numbers to remember
- Lab: 10,000 × 100 ms tasks: 200-thread pool 5.15 s, virtual threads 0.27 s.
- Lab: pinning: 2,000 tasks in
synchronized took 100 s vs 0.11 s with ReentrantLock (JDK 21, 2 carriers).
- Lab: worst GC-shaped step 40 ms (Serial) vs 8 ms (ZGC) on a small run.
Pitfalls
- Adopting virtual threads without checking pinning and pools.
@Transactional on private or self-invoked methods.
- Default GC and heap settings in containers without measurement.
- N+1 queries hidden by ORM lazy loading.
- Diagnosing latency without GC logs and JFR.
Glossary
- Carrier thread: a platform thread that runs virtual threads.
- Pinning: a virtual thread unable to unmount from its carrier.
- happens-before: the JMM's visibility and ordering guarantee.
- JFR: Java Flight Recorder.
- Propagation: how a transactional method joins or starts transactions.
194C
Key ideas
- PostgreSQL internals: heap and TOAST, MVCC with xmin/xmax, visibility map, VACUUM and freezing, WAL, checkpoints, buffer cache, planner statistics.
- Isolation: read committed (default), repeatable read (snapshot), serializable (SSI); anomalies: lost update, non-repeatable read, phantom, write skew.
- Planner: cost model, estimates vs actuals, extended statistics, join methods, index types (B-tree, GIN, GiST, BRIN), partial and covering indexes.
- L4 toolkit:
EXPLAIN (ANALYZE, BUFFERS), pg_stat_statements, pg_stat_activity, pg_locks, auto_explain, bloat checks.
- L5 decisions: pooling and pool size, partitioning, replicas and read routing, isolation per use case, schema evolution.
- Concurrency: races, atomics and locks, memory visibility, false sharing, contention; models: threads and locks, actors, CSP, async/await, STM.
Numbers to remember
- Lab: read tps peaked ~101k at 4 clients, fell to ~49k at 64; write tps peaked ~4.8k, fell to ~3.7k at 64.
- Lab: Little's law: 64 clients / 3,682 tps = 17.4 ms.
- Pool sizing starting point: about cores × 2 (+ spindles), then measure.
Pitfalls
- Pools sized to app threads (hundreds of connections).
- Read-modify-write without locks, atomics or retries.
- Trusting plans without comparing estimated and actual rows.
- Long transactions blocking VACUUM and DDL.
- Shared mutable counters on hot cache lines.
Glossary
- MVCC: multi-version concurrency control.
- SSI: serializable snapshot isolation.
- Write skew: two transactions each read a condition and write different rows, jointly violating it.
- PgBouncer: a lightweight PostgreSQL connection pooler.
- False sharing: contention on a cache line shared by unrelated variables.
194D
Key ideas
- Networking for L3: TCP handshake, flow and congestion control, retransmission timeouts, head-of-line blocking, TLS 1.3, HTTP/2 and HTTP/3, DNS caching and TTLs, load-balancer behaviour.
- Distributed fundamentals: partial failure, unbounded delays, clocks (physical, logical, hybrid), idempotency, retries and deduplication.
- Replication and consensus: leader-based, multi-leader, leaderless; quorums; Raft/Paxos; leases and fencing tokens.
- Consistency models: linearizable, sequential, causal, eventual; CAP and PACELC.
- L4–L6: debugging with packet captures, metrics and traces; split brain; multi-region designs; operating coordination services.
- System design: requirements and numbers first, then data model, partitioning, replication, caching, async boundaries and failure handling with explicit trade-offs.
Numbers to remember
- Lab (one machine): etcd write p50 1.26 / 1.72 / 2.03 ms for 1 / 3 / 5 members.
- Lab: leader loss → ~1.5 s write gap (election timeout ≈ 1 s).
- Majority of n members = ⌊n/2⌋ + 1; tolerates ⌊(n−1)/2⌋ failures.
Pitfalls
- Even-sized consensus clusters (4 tolerates no more failures than 3).
- Spreading consensus members across far regions without measuring write latency.
- Storing bulk data in coordination services.
- Using stale reads where correctness needs linearizable ones.
- Failover without fencing.
Glossary
- Quorum: the majority required to commit.
- Election timeout: time without heartbeats before followers start an election.
- Linearizability: operations appear to happen atomically in real-time order.
- Fencing token: a monotonically increasing number that rejects stale leaders.
- PACELC: if partitioned, choose A or C; else choose latency or consistency.
194E
Key ideas
- Containers: namespaces (pid, net, mnt, uts, ipc, user, cgroup), cgroups (cpu, memory, io, pids), union filesystems, image layers, OCI runtimes.
- Kubernetes: API server + etcd as desired state; controllers and the scheduler reconcile; kubelet runs pods; Services, kube-proxy/eBPF networking, CNI, CSI.
- Resources: requests (scheduling, share) vs limits (CPU throttle, memory OOM); QoS classes; HPA/VPA/cluster autoscaler.
- L4: OOMKilled, CrashLoopBackOff, Pending (unschedulable), throttling, DNS and network policy issues, IAM errors.
- Cloud at L5/L6: account/project structure, IAM least privilege, networking, managed vs self-run, cost (FinOps), multi-region.
- CI/CD at L5/L6: pipelines as products, OIDC to cloud, signed artefacts and provenance, progressive delivery, platform golden paths.
Numbers to remember
- CFS period 100 ms; a 0.5 CPU limit = 50 ms of CPU per 100 ms.
- Lab: bursty load at 0.4 CPU average under a 0.5 CPU limit: median latency 39.6 → 76.4 ms, 31 throttled periods.
- Lab: steady load above the limit (0.4 needed, 0.25 allowed): 20 → 95 ms.
Pitfalls
- Judging CPU limits by average utilisation.
- No memory limits (noisy neighbours) or memory limits below real peaks (OOM loops).
- Thread pools sized from host cores instead of container limits.
- Long-lived cloud keys in CI.
- Platform policies without measurement of their latency and cost effects.
Glossary
- CFS quota: the scheduler's per-period CPU time cap.
- Throttling: pausing a cgroup's tasks until the next period.
- QoS class: Guaranteed, Burstable or BestEffort, from requests and limits.
- Reconciliation loop: compare desired and actual state, act, repeat.
- Golden path: a supported, paved way for teams to build and deploy.
194F
Key ideas
- Security from the attacker's side: threat modelling (STRIDE, attack trees), trust boundaries, authN/authZ (BOLA), injection, SSRF, deserialisation, supply chain, secrets; classes of bugs removed by design (parameterised queries, constant-time compare, safe defaults).
- Observability from first principles: metrics (aggregates, low cardinality), logs (events), traces (causality), profiles; SLIs/SLOs and burn-rate alerts; sampling; cardinality and cost control.
- AI integration at L5/L6: models as unreliable dependencies: evals, guardrails, prompt-injection containment, cost and latency budgets, fallbacks, versioning and drift monitoring.
- L6: running security programmes, observability platforms and AI platforms across teams with governance.
Numbers to remember
- Lab: a histogram with 100,000
user_id values → ~1.8 M series, 341 MB in-process, 113 MB scrape, 11 s to render.
- Lab:
== leaked ~1.5 ns across 63 matching bytes; compare_digest was flat.
- Histogram with default buckets ≈ 18 series per label combination.
Pitfalls
- Unbounded label values (IDs, URLs with parameters, error messages).
- Dashboards without SLOs; alerts on causes instead of symptoms.
- Security reviews that check tools ran but never model attackers.
- Shipping LLM features without evals, budgets or injection controls.
- Arguing exploitability instead of removing bug classes.
Glossary
- Cardinality: number of distinct series a metric produces.
- Exemplar: a sample trace ID attached to a metric observation.
- STRIDE: spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege.
- Timing attack: inferring secrets from how long operations take.
- Burn rate: speed of error-budget consumption relative to the SLO.
194G
Key ideas
- Breadth targets L3/L4: explain internals and diagnose problems that cross into the area.
- Front end: the browser rendering pipeline, the event loop, network waterfalls, Core Web Vitals.
- React: reconciliation, keys, re-render causes, memoisation; Angular: zones and change detection, signals, OnPush.
- Search: analysis (tokenise, normalise, stem), inverted indexes, BM25 ranking, n-grams for fuzzy matching, relevance evaluation.
- NoSQL: document, key-value, wide-column, graph; model by access pattern; consistency and partitioning trade-offs.
- GPU/ML: SIMT execution, memory hierarchy and bandwidth, batching, mixed precision, why inference is memory-bound.
Numbers to remember
- Lab: ILIKE substring scan 602 ms vs trigram index 24 ms vs full-text GIN 3.2 ms on 106,920 passages.
- Lab: full-text matched 79% more passages (stemming) but found nothing for "idempotncy"; trigram found 4,820.
Pitfalls
LIKE '%…%' search in production on large tables.
- Assuming full-text search handles typos.
- Blaming "the front end" or "the database" without tracing the request.
- Choosing NoSQL for flexibility without knowing the access patterns.
- Treating GPUs as faster CPUs without considering memory bandwidth and batching.
Glossary
- Stemming: reducing words to a common root.
- Trigram: a 3-character substring used for fuzzy matching.
- Reconciliation: React's process of computing UI updates.
- Change detection: Angular's process of updating views when data changes.
- SIMT: single instruction, multiple threads, the GPU execution model.
195A
Key ideas
- HTML semantics are a contract: native elements bring focus, keyboard behaviour and accessibility roles.
- CSS at L3: cascade, specificity and layers; box model; formatting contexts; flexbox and grid algorithms; containment.
- JavaScript's execution model: one main thread, task and microtask queues, rendering opportunities; promises and async/await; memory and closures.
- TypeScript: structural typing, inference, narrowing, generics; deliberate unsoundness (any, bivariance, casts); designing types that make illegal states unrepresentable.
- Browser internals: parse → style → layout → paint → composite; forced synchronous layout; compositor-only animations; network and caching.
- Accessibility from first principles: the accessibility tree, names/roles/states, focus management, live regions, WCAG.
Numbers to remember
- Lab: interleaved reads/writes on 2,000 rows ~800 ms vs batched ~7 ms.
- Lab: click during a 500 ms task waited ~470 ms; chunked work ~20 ms.
- INP good < 200 ms; aim for tasks < 50 ms.
Pitfalls
- Reading layout properties inside write loops.
- Long synchronous tasks on the main thread.
div buttons and ARIA used where native elements exist.
any and unchecked casts at system boundaries.
- Measuring only on fast developer machines.
Glossary
- Forced synchronous layout: layout computed immediately because script read geometry after a change.
- Long task: main-thread work over 50 ms.
- INP: Interaction to Next Paint.
- Microtask: a job (e.g. promise callback) run before the next task.
- Accessibility tree: the browser's semantic representation exposed to assistive technology.
195B
Key ideas
- React at L5: rendering strategies (CSR, SSR, SSG, streaming, Server Components), state placement, re-render control, data fetching and caching, concurrency features.
- Web performance as a discipline: Core Web Vitals (LCP, INP, CLS) at p75 in the field; critical path, render-blocking resources, images, fonts, JavaScript cost; budgets in CI; RUM.
- Frontend security: XSS (auto-escaping, Trusted Types, sanitisation), CSP, SRI, CSRF and cookies (SameSite), clickjacking, dependency supply chain, secrets never in bundles.
- Testing strategy: unit, component, integration, end-to-end, visual and accessibility checks; flake control; contract tests with the backend.
- Architecture: modules and boundaries, design systems, monorepos, micro-frontends (rarely), state management choices.
- Deployment: immutable assets with hashed names, CDN caching, feature flags, rollbacks, version skew between client and server.
Numbers to remember
- Lab: render-blocking script → FCP ~835 ms;
defer → ~28 ms.
- Lab: unsized 600 × 300 image → CLS 0.097; sized → 0.
- Core Web Vitals "good": LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1, at p75.
Pitfalls
- Third-party scripts in
<head> without defer/async.
- Images and embeds without reserved space.
- Measuring only in the lab on fast hardware.
dangerouslySetInnerHTML with unsanitised input; no CSP.
- Client/server version skew after deploys (old bundles calling new APIs).
Glossary
- FCP / LCP: first / largest contentful paint.
- CLS: cumulative layout shift.
- RUM: real-user monitoring.
- Trusted Types: a browser API that blocks unsafe DOM sinks unless values are vetted.
- Version skew: different client and server versions running together.
196A
Key ideas
- Python at L3: object model, GIL and its release in native code, threads vs processes vs asyncio, memory and copying in NumPy/pandas, packaging and environments, typing.
- ML fundamentals at L4: generalisation, overfitting, validation design, leakage (target, temporal, preprocessing, duplicates), calibration, imbalanced metrics.
- LLM application architecture: prompts as code, context assembly, structured outputs, tools, caching, routing, guardrails, observability.
- RAG, measured: chunking, hybrid retrieval, reranking, permissions; retrieval and generation evaluated separately.
- Evaluation as statistics: golden sets, paired comparisons, confidence intervals, contamination, judge calibration.
Numbers to remember
- Lab: pure-Python ×2 in threads 1.47 s vs processes 0.76 s (vs 0.72 s for one).
- Lab: NumPy ×2 in threads: 2× throughput (GIL released).
- Lab: 100 × 0.1 s waits overlap to ~0.1 s with threads or asyncio.
Pitfalls
- Threading CPU-bound Python and expecting speed-ups.
- Preprocessing (scaling, feature selection) fitted on all data before splitting.
- Changing prompts or models without rerunning evals.
- Treating a small eval improvement as real without intervals.
- RAG without permission filtering.
Glossary
- GIL: CPython's Global Interpreter Lock.
- Free-threaded Python: a CPython build without the GIL (PEP 703).
- Leakage: information from evaluation data or the future reaching training.
- Context assembly: choosing and ordering what goes into a model call.
- Paired comparison: comparing systems on the same items.
196B
Key ideas
- AI security: prompt injection (direct and indirect), exfiltration channels, excessive agency, the lethal trifecta, tenant isolation of caches/memory/indexes, supply chain of models and tools.
- Inference and application engineering: prefill vs decode, batching and KV cache, streaming, model routing, caching, structured outputs, timeouts and fallbacks.
- Multi-tenancy: per-tenant rate limits (atomic token buckets), token budgets, concurrency caps, priority classes, batch paths.
- Agents and workflows: least autonomy that works; budgets, checkpoints, approvals, idempotent tools, trajectory evals.
- AI observability: GenAI spans, token and cost attribution, quality signals, redaction, sampling.
- Deployment: eval gates, canaries for prompts and models, version pinning, rollback, drift monitoring.
- Research depth is optional for most AI engineers, essential when building novel models or methods.
Numbers to remember
- Lab: non-atomic limiter admitted 295 vs 49 (expected ~50).
- Simulation: no limits → B waited 48 s median; global cap → B lost 58%; per-tenant → B 100% at 0.08 s.
Pitfalls
- Shared queues without tenant isolation.
- Rate limits by request count when cost is per token.
- Read-modify-write limiters without atomicity.
- Agents without budgets or approvals.
- Model or prompt changes shipped without eval gates.
Glossary
- Token bucket: a limiter allowing bursts up to a size and a steady refill rate.
- Weighted fair queueing: serving tenants in proportion to assigned weights.
- Noisy neighbour: a tenant whose load degrades others.
- Priority class: a tier of traffic served ahead of lower tiers.
- Batch API: an asynchronous, cheaper path for bulk model requests.
CS
Key ideas
- Rate yourself per topic with evidence, not years: artefacts, explanations, debugging stories, decision records, incidents.
- Choose gaps by target role: what interviews and the job will probe at L5/L6, and what breadth needs L3/L4.
- Depth interviews walk a topic from L2 to L6; prepare stories with numbers for each level.
- Translate private, company-specific depth into public, general evidence: write-ups, open projects, talks.
- Plan twelve months of deliberate practice: a few projects that close the right gaps, spaced review, mock interviews.
Numbers to remember
- Lab: Volumes 2–16 contain 122 projects, ≈ 138 estimated weeks; a 12-month plan covers about a third, so choose.
Pitfalls
- Claiming levels without evidence.
- Spreading effort across every topic instead of the target role's gaps.
- Evidence only interviewers inside your company could understand.
- Plans with no checkpoints or mock interviews.