JVM uses different GC algorithms: Serial GC (simple, single-threaded, pauses long), Parallel GC (multi-threaded, high throughput), G1 GC (balanced for heaps >2GB, predictable pauses), ZGC (ultra-low latency <10ms pauses). Choosing the right GC depends on application priorities: throughput vs latency vs memory.
Serial GC: One janitor cleaning the entire office building (complete focus but slow). Parallel GC: 10 janitors cleaning 10 rooms in parallel (faster, but requires coordination). G1 GC: Janitors focus on messiest rooms first (balanced approach).
What is the 'Stop-The-World' (STW) event in Garbage Collection? How do modern collectors minimize STW?