Java / JVM Architecture (Java21) Interview questions
What is the difference between Serial GC and Parallel GC?
Both are older, simpler stop-the-world collectors, but they differ in how many threads do the collection work.
| Serial GC | Parallel GC |
| Single thread performs the entire collection | Multiple threads collect Young and Old generations in parallel |
-XX:+UseSerialGC | -XX:+UseParallelGC |
| Best for small heaps, single-CPU machines, or simple client applications | Best for multi-core machines where raw throughput matters more than pause time |
Neither collector attempts to minimize individual pause times the way G1, ZGC, or Shenandoah do - both simply pause every application thread for the duration of the collection, differing only in how quickly that pause finishes.
More Related questions...