rgoussu@goussu: ~/library/java
~/library/java cat java-deep-dive.md

Deep dive Java

# Java beyond the syntax — JVM internals, GC, virtual threads, the modern language features, and the ecosystem.

Conceptsaved 2026-08-08updated 2026-08-09 #java#jvm#internals#concurrency

Overview

Deep Java competence is mostly JVM competence: how bytecode is JIT-compiled, how the garbage collectors trade throughput for pause time, how the memory model defines what concurrent code may observe. On top of that sits a language that has moved fast since 8 — records, sealed types, pattern matching, virtual threads — and an ecosystem (Spring, GraalVM) that shapes how it is used in practice.

Key points

  • JVM execution: classloading, bytecode, interpreter → C1 → C2 tiered JIT, escape analysis and inlining; JIT vs. GraalVM native-image AOT (startup/memory vs. peak throughput).
  • Garbage collectors: G1 (balanced default), ZGC & Shenandoah (sub-millisecond pauses), Parallel (throughput); generational hypothesis, and reading GC logs before tuning anything.
  • Java Memory Model: happens-before, volatile, final field semantics — the contract that makes concurrent Java analyzable; java.util.concurrent as the applied layer.
  • Virtual threads (Loom, 21+): cheap threads that park instead of blocking OS threads; structured concurrency and scoped values as the follow-on; when they beat — and don't beat — reactive stacks.
  • Modern language: records, sealed interfaces + pattern matching for exhaustive domain modeling, switch expressions, text blocks; the 6-month release cadence and LTS strategy.
  • Ecosystem mechanics: Spring's proxy/AOP model and what it costs, dependency injection, JPMS modules, profiling with JFR/Async-profiler.
  • To explore: Valhalla (value types), Panama (FFM API replacing JNI), mechanical sympathy (false sharing, cache lines) on the JVM.

Practice

  • Exercism Java track (source) — warm-up katas; deliberately reach for records, sealed types, and pattern matching where the older idiom would do.
  • Virtual-threads rewrite (source) — take a thread-pool-based concurrent crawler (or write one), port it to virtual threads + structured concurrency, and compare thread counts and code shape under load.
  • Coding Challenges in Java (source) — build your own Redis or wc; good scale for practicing JFR profiling on something real.
  • One Billion Row Challenge (source) — the flagship: aggregate a billion rows as fast as the JVM allows, profiling and measuring every step from naive baseline to memory-mapped byte crunching.

Related