Java Garbage Collection

Garbage Collection automatically reclaims heap memory occupied by objects that are no longer reachable by any live thread. 1. Why GC exists Manual memory management is hard and error-prone: The JVM uses GC to: Production impact: 2. Heap structure (Young, Old, Metaspace) Modern HotSpot heap (simplified view): +———————————————————+| Java Heap || || +——————-+ +—————————–+ || […]

Java Memory Model

The Java Memory Model defines how threads interact through memory and what visibility and ordering guarantees the JVM provides. 1. Why the Java Memory Model exists The JMM exists to answer one critical question: When multiple threads read and write shared variables, what outcomes are legal? Without a well-defined memory model: The JMM: Pre-Java 5, […]

JVM

The JVM is the runtime environment that loads, verifies, optimizes, and executes Java bytecode on a specific machine. 1. What the JVM is responsible for At a high level, the JVM is responsible for: Why this exists: Real-world example: 2. JVM architecture (high level) A conceptual view: +————————————————————–+| JVM PROCESS || || +——————–+ +——————————-+ || […]