Parallel Garbage Collector in Java

Parallel Collector

Garbage collection with parallel collector is much faster that serial collector. As you know today almost all Java applications run on machines with a lot of physical memory and multiple CPUs. The parallel collector, also known as the throughput collector, was developed in order to take advantage of available CPUs rather than leaving most of CPU processes idle. Therefore throughput of parallel collector is much better than serial collector. If you are not aware about garbage collection fundamentals and object generations, then I will recommend you to first read my blog “How memory management (Garbage Collection) works in Java and difference types of Garbage Collectors in Java?

serial vs parallel gc

Young Generation Collection Using the Parallel Collector

The parallel collector uses a parallel version of the young generation collection algorithm utilized by serial collector as shown in figure. If you do not know collection process of serial collector, please first read my blog “Serial Garbage Collector in Java”. It is still a Stop-The-World and copying collector, but performing the young generation collection in parallel, using many CPUs, decreases garbage collection overhead and hence increases application throughput. Figure illustrates the differences between the serial collector and the parallel collector for the young generation.

Old Generation Collection Using the Parallel Collector

Old generation garbage collection for the parallel collector is done using the same serial mark-sweep-compact collection algorithm as the serial collector.

When to Use the Parallel Collector

Those applications running on machines with one than one CPUs and do not have pause-time constraints can use parallel collector for garbage collection. Examples of applications for which the parallel collector is often appropriate, those that do batch processing, billing, payroll, scientific computing, and so on. You may want to consider choosing the parallel-compacting collector (described next) over the parallel collector, since the former performs parallel collections of all generations, not just the young generation.

Parallel Collector Selection

In the Java 5 release, the parallel collector is automatically chosen as the default garbage collector on server-class machines. On other machines, the parallel collector can be explicitly selected by using the -XX:+UseParallelGC command line option.

Deals on Tablets, Get up to 25% off on Tablets - Dell, Lenovo, Samsung, HCL and others.

4 thoughts on “Parallel Garbage Collector in Java

  1. Pingback: Parallel Compacting Garbage Collector in Java | So Many Word

  2. Pingback: How memory management (Garbage Collection) works in Java and difference types of Garbage Collectors in Java | So Many Word

  3. Pingback: Concurrent Mark Sweep (CMS) Garbage Collector in Java | So Many Word

  4. I just like the valuable info you supply in your articles. I will bookmark your blog and take a look at again here regularly. I am quite certain I will learn plenty of new stuff right here! Good luck for the next!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>