5 exercises on garbage collection tuning vocabulary.
0 / 5 completed
1 / 5
What does a stop-the-world (STW) pause refer to in garbage collection?
Stop-the-world: the runtime suspends all application (mutator) threads so the collector can scan or move objects without races. Long STW pauses hurt latency, which is why low-pause collectors like G1 or ZGC aim to do most work concurrently.
2 / 5
What is the generational hypothesis that most GCs rely on?
Generational GC: empirically most allocations become unreachable quickly. Collectors split the heap into a young generation (collected often and cheaply) and an old generation (collected rarely), reducing total work.
3 / 5
What problem does a high promotion rate indicate?
Promotion: objects surviving enough young-gen collections are moved to the old generation. A high promotion rate fills old gen quickly, causing frequent major or full GCs that are far more expensive than minor ones.
4 / 5
In the JVM, what does -Xmx control?
-Xmx: sets the maximum heap size. Setting it too low causes frequent GCs and OutOfMemoryError; too high can cause long pauses and memory pressure on the host. -Xms sets the initial heap size.
5 / 5
What is the main tuning goal trade-off in garbage collection?
Throughput vs latency: some collectors maximize total work done per second (throughput) but allow longer pauses; others minimize pause times for responsiveness at the cost of CPU overhead. Tuning chooses the right balance for the workload.