RecapsKayavak

Kayavak / Recaps / Revision and Mastery

Recaps · Volume 20

Revision and Mastery

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.

Open the volume

213A

Concepts to Revisit Forever I: Computer Science and Java

One line each

  • Pointers/references: addresses vs restricted handles; Java passes references by value.
  • Memory: virtual pages, TLB, cache lines, ~1 ns → ~100 ns; locality decides speed.
  • Processes: isolated address spaces; ~100 µs to create.
  • Threads: shared memory, own stacks; correctness needs synchronisation.
  • Networking: layers; latency from distance and round trips.
  • TCP: reliable ordered bytes; handshake, retransmission, flow and congestion control.
  • DNS: hierarchical, cached by TTL; a common outage cause.
  • Concurrency: atomicity, visibility, ordering; avoid shared mutable state.
  • DSA: choose by operation costs and memory layout.
  • Collections: equals/hashCode contracts; immutable by default; concurrent versions for sharing.
  • Generics: compile-time types, erasure, PECS.
  • Streams: lazy pipelines pulled by terminal operations.
  • Exceptions: handle where you can act; keep causes; try-with-resources.
  • JVM: bytecode, JIT with profiles, warm-up; all memory areas count in containers.
  • GC: generational; G1 default; ZGC/Shenandoah for low pauses; leaks are unintended references.
  • Java concurrency: happens-before; prefer high-level tools.
  • Virtual threads: cheap to create and block; still limit concurrency; not for CPU-bound speed-ups.

Numbers to remember

  • L1 ~1.3 ns, L2 ~4–5 ns, RAM ~140–170 ns random; sequential ~0.3–0.7 ns/element.
  • fork ~100 µs; pthread ~34 µs; Java platform thread ~105 µs; virtual thread ~7.6 µs.
  • Light in fibre ~5 µs/km.

Glossary

  • TLB: cache of virtual-to-physical page mappings.
  • Happens-before: the Java Memory Model's visibility guarantee.
  • Carrier thread: an OS thread that runs virtual threads.
  • Head-of-line blocking: one lost packet delaying later data on the same stream.
  • PECS: producer extends, consumer super.

213B

Concepts to Revisit Forever II: Backend, Data and Distributed Systems

One line each

  • HTTP: methods with meanings (safe, idempotent), caching and conditional headers, versions 1.1/2/3.
  • REST: resources, uniform interface, stateless, cacheable; idempotency keys for POST.
  • Transactions: ACID; short; no remote calls; retry on serialization failures.
  • Caching: source of truth, staleness, invalidation, stampedes, fallback, eviction.
  • Security: authn, authz per object, TLS, least privilege; broken access control tops the list.
  • Backend concurrency: pools are queues; limits and timeouts everywhere.
  • SQL: declarative; joins, windows, NULL logic.
  • Indexes: shape must match the query; costs on writes.
  • Query plans: estimated vs actual rows; read bottom-up.
  • Isolation: RC allows lost updates and write skew; RR detects same-row conflicts; SERIALIZABLE aborts anomalies.
  • Replication: sync vs async; lag; failover and fencing.
  • Idempotency: same effect twice; keys, upserts, dedupe.
  • Retries: safe operations, bounded, jittered, budgeted, one layer.
  • Ordering: no global clock; sequence per key; tolerate reordering.
  • Consistency: choose the model per operation.
  • Partitions: network splits (CAP) and data sharding (keys follow queries).
  • Messaging: queues vs logs; at-least-once + idempotency; outbox.

Numbers to remember

  • Lab: 695 of 1,000 increments lost at RC with read-then-write; 2,135 retries at RR; write skew 200/200 at RC and RR, 0/200 at SERIALIZABLE.
  • 3 layers × 3 retries = 27 calls.

Glossary

  • Write skew: two transactions read overlapping data and write different rows, together violating a rule.
  • Snapshot isolation: each transaction reads one consistent snapshot.
  • Lamport clock: a logical counter ordering events causally.
  • Fencing token: a number that lets storage reject a stale leader's writes.
  • Retry budget: a cap on retries as a share of normal traffic.

213C

Concepts to Revisit Forever III: Infrastructure, System Design, Frontend and AI

One line each

  • Linux: processes, descriptors, mappings; know the observation tools.
  • Docker: namespaces see, cgroups limit, images are layers.
  • Networking: every hop adds latency, limits and failure modes.
  • Kubernetes: controllers reconcile actual to desired state.
  • Requirements: numbers, not adjectives.
  • Capacity: simple arithmetic plus headroom.
  • Bottlenecks: the first resource to saturate; queueing near saturation.
  • Availability: series multiplies; redundancy needs independence.
  • Caching / partitioning / replication: design choices with failure modes.
  • Failure: partial failure is the hard case; practise recovery.
  • Browser: DOM, CSSOM, blocking resources, one main thread.
  • CSS: cascade, box model, layout algorithms.
  • JavaScript: event loop, tasks and microtasks; long tasks block.
  • Accessibility: semantic HTML builds the accessibility tree; keyboard and announcements.
  • Rendering: layout, paint, composite; animate transforms.
  • Performance: LCP, INP, CLS in the field.
  • Frontend security: XSS, CSRF, clickjacking, token theft, dependencies.
  • Probability: base rates, sampling error, calibration.
  • Embeddings: meaning as geometry; weak on exact matches.
  • Attention: softmax(QKᵀ/√d)V; quadratic in length.
  • Transformers: attention + MLP blocks; parallel training, sequential generation.
  • RAG: retrieve, rerank, cite, abstain; evaluate retrieval separately.
  • Evaluation: large sets, paired comparisons, zero-tolerance checks.
  • Inference: prefill vs decode; batching; KV cache.
  • Agents: loops with narrow tools, limits and confirmations.
  • AI security: defences outside the model.

Numbers to remember

  • Lab: 200 ms task → timer 199 ms late; 5 ms chunks → 5.5 ms; q·k spread 22.8 at d = 512 → 1.0 after ÷ √d.
  • 0.999⁵ = 99.5% (~216 min/month); correlated pairs 99.83%.

Glossary

  • Microtask: a promise callback, run after the current task before the next.
  • Little's law: concurrency = throughput × latency.
  • Failure domain: a set of components that can fail together.
  • KV cache: stored keys and values from earlier tokens.
  • Accessibility tree: the browser's semantic model exposed to assistive technology.

214

Technology Churn Policy: Memorise, Understand, Track

Key ideas

  • Memorise a small, stable core you use weekly, with spaced retrieval.
  • Understand eight mechanisms: slow queries, duplicate async work, reflow, timeouts, unhealthy pods, stale caches, hallucinations, unsafe tool calls; reproduce each.
  • Track APIs, service and model names, framework and tool versions, patch releases, with a routine and pinned versions.
  • Thin interfaces around fast-moving dependencies.

Numbers to remember

  • 12-month stable releases: FastAPI 119, OpenAI Python SDK 109, Angular 103, React 29, PyTorch 9, TypeScript 3.
  • Angular: a new major each ~6 months; React: one new major in 3 years.

Glossary

  • Spaced repetition: reviewing at increasing intervals just before forgetting.
  • Retrieval practice: recalling from memory rather than rereading.
  • LTS: long-term-support release line.
  • Tech radar: a periodic adopt/trial/hold assessment of technologies.
  • Semantic versioning: MAJOR.MINOR.PATCH, where majors may break APIs.

215

The Master Competency Checklist

Key ideas

  • 93 competencies in 15 disciplines, each with a "show it by" task and where it's taught.
  • Tick only what you've shown unaided; keep the artefacts.
  • Depth in your track, breadth elsewhere (Volume 17).
  • Quarterly re-rating; three gaps at a time.

Counts by discipline

Computer science 7 · Frontend 8 · Backend 7 · Databases 6 · Distributed systems 7 · Infrastructure 5 · Cloud 5 · DevOps 5 · Observability 5 · Security 6 · Testing 6 · System design 6 · AI 10 · Architecture 5 · Product 5.

Glossary

  • Competency: something you can do, observably.
  • Artefact: checkable evidence (code, measurement, write-up, recording).
  • Track: backend, frontend or AI specialisation with deeper targets.

216

The Final Operating Model

Key ideas

  • The goal is reasoning through layers, not collecting technologies.
  • Top-down for design: product → requirements → architecture → … → evolution.
  • Bottom-up for incidents: symptom → cause in lower layers → impact in higher layers.
  • For every step of a request: what happens, why, how it fails, how to measure, how to improve.

Numbers to remember

  • Lab: TLS handshake ~2.1 ms (largest connection cost locally); API work ~1.2 ms; new connection total ~4.3 ms; reused ~1.2–2.2 ms; outbox relay ~31 ms (50 ms polling).
  • New HTTPS connection: ≥ 3 round trips (TCP, TLS 1.3, request), plus DNS if uncached; 20–60 ms each on mobile.

Glossary

  • Operating model: the layered way of reasoning about a system from purpose to evolution.
  • Server-Timing: an HTTP header reporting server-side timing breakdowns.
  • Round trip (RTT): time for a message to go to a peer and back.
  • Polling interval: how often a loop checks for new work; sets a floor on reaction time.