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).