MindMap Gallery Garbage collection algorithm brain map
The following introduces the current mainstream and historical garbage collectors, CMS collector, G1 collector, ZGC collector, Serial, Serial Old, Parallel, Parallel Old, and ParNew. Hurry and collect the pictures below to learn!
Edited at 2021-07-20 18:06:18Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
garbage collector
CMS collector
Concurrent Mark Sweep
Get the minimum pause time as the goal of the garbage collector
Collection Algorithm: Mark and Sweep Algorithm
Work steps
initial mark
STW, faster
concurrent marking
Running together with the user thread takes a long time
relabel
STW, longer than the initial marking time,
Incremental update algorithm using three-color labeling method
concurrent cleanup
For unmarked objects, newly added objects will be marked black.
Concurrency reset
Reset the mark data during this GC process
advantage
concurrent collection
low pause
shortcoming
Sensitive to CPU resources. In the process without STW, it will compete with services for resources.
There is floating garbage
Using the mark-and-sweep algorithm will generate a lot of space fragmentation
There is uncertainty in the execution process. When the garbage collection is not completed, if full gc is triggered again, it will cause concurrency failure, STW, and use Serial Old for garbage collection.
G1 Collector
Grabage first
A garbage collector for servers, targeting machines equipped with multiple processors and large amounts of memory.
Divide the heap into multiple independent regions of equal size Region
Generally, the heap is divided into 2048 parts on average.
Still using the concept of generations, the same Region may belong to different generations at different times.
Put large objects into separate Humongous
It is generally considered that an object is a large object if it exceeds 50% of the Region. If the size exceeds the Region, it is stored in a continuous Humongous Region.
Full Gc will also collect objects in this area
Work steps
initial mark
STW, fast
concurrent marking
Same as CMS
final mark
Same as CMS
Screening and recycling
Sort the recycling value and cost of each Region, and develop a recycling plan based on the user's expected GC pause time.
STW
Features
Parallelism and Concurrency
Collection by generation
spatial integration
predictable pauses
Collection classification
Gc
YoungGC is not triggered when the Eden area is full. First calculate how long it takes to recycle the Eden area. If the time is much less than the expected pause time, increase the Region of the young generation.
MixedGC
Triggered after the heap occupancy of the old generation reaches the set value, all young and part of Old and large object areas are recycled
If it is found that there are not enough empty Regions to carry the copy object, a FullGC will be triggered.
ZGC collector
Target
Supports terabyte-scale heaps
Maximum GC pause time does not exceed 10ms
Laying the foundation for future GC features
Worst case, throughput reduced by 15%
regardless of generation
Due to the complexity of the implementation, a single-generation version is currently implemented and a multi-generation version may be implemented in the future.
Region-based memory layout
ParNew
Similar to Parallel collector
Ability to work with CMS
Parallel Old
Multi-threaded version of Serial Old
The default number of threads is the number of CPU cores
Applicable to old age
Paired with new generation algorithm
Parallel
Collection algorithm: tag sorting algorithm
Parallel
Multi-threaded version of Serial
The default number of threads is the number of CPU cores
Suitable for new generation
With old generation algorithm
Serial Old
Parallel Old
Collection Algorithm: Copy Algorithm
Serial Old
Single thread STW
Applicable to old age
The new generation algorithm of collocation
Serial
ParNew
Parallel
Alternative collector for CMS concurrency failure
Collection algorithm: tag sorting algorithm
Serial
Single thread, STW
Suitable for new generation
With old generation algorithm
Serial Old
CMS
Collection Algorithm: Copy Algorithm