A new generation collector of garbage collectors for Java virtual machines

Source: Internet
Author: User
Tags garbage collection
New generation collectors for hotspot virtual machines

There are seven main types of hotspot garbage collectors: As shown in the picture:

The upper part of the figure is the new generation of garbage collectors, the following section represents the old age of the garbage collector, the two garbage collector between the line means that two collectors with the use. Serial collector

The serial collector is the most basic and most developed collector. The serial collector is a single-threaded collector, but his "single-threaded" meaning does not only use a single CPU or thread to complete the garbage collection, but more importantly, when he does garbage collection, all the other worker threads must be paused until the collection is complete.

Serial/serial Old collector operation schematic

Advantages of Serial: simple and efficient (one-line turndown with other collectors), for environments that qualify a single CPU, the serial collector, due to the overhead of having no thread interaction, is naturally able to achieve the highest single thread collection efficiency. The serial collection period is a good choice for running virtual machines in client mode. parnew Collector

The Parnew collector is actually a multi-threaded version of the serial collector, which includes all the control parameters available to the serial collector, the collection algorithm, the Stop the world, the object allocation rules, and so on, in addition to using threads for garbage collection. The recycle policy is exactly the same as the serial collector.

Parnew/serial Old collector operation schematic

Advantages and disadvantages of the Parnew collector: The Parnew collector is never better than serial in a single CPU environment, and even with the overhead of thread interaction, the collector is not guaranteed to exceed the serial collector in the two CPU environments implemented through Hyper-Threading technology. Of course, as the number of CPUs increases, he will benefit from the use of system resources in GC. Parallel Scavenge collector

The

Parallel scavenge collector is also the collector of the replication algorithm
Parallel scavenge: Parallel scavenge attention is different from other collectors, The focus of collectors such as CMS is to shorten the downtime of user threads as much as possible, while the goal of the parallel scavenge collector is to achieve a controllable throughput, which is the ratio of the CPU's time spent running user code to the total CPU time, i.e. throughput = Run user code time/(run user code time + garbage collection time).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.