当前位置:网站首页>New generation garbage collector ZGC
New generation garbage collector ZGC
2022-07-06 19:56:00 【Chat with Lao Wang】
Catalog
1、 What is? ZGC
ZGC(The Z Garbage Collector) yes JDK 11 Launched in the pursuit of an ultimate low latency experimental garbage collector .
ZGC It was recently by Oracle by OpenJDK New open source garbage collector . It is mainly composed of Per Liden To write .ZGC Be similar to Shenandoah or Azul Of C4, Focus on reducing pause times while still compressing the heap .
2、ZGC Design purpose
ZGC The core of is a concurrent garbage collector , The goal of its design is :
1) The pause time shall not exceed 10ms;
2) The pause time doesn't vary with the size of the heap , Or the size of the active object ;
3) The supported heap range is 8MB~4TB Level ( Future support 16TB).
All in all , ZGC The purpose of is to reduce the pause time at the same time , Can still compress the heap .
3、ZGC present situation
Up to date JDK15 Look at ,“ The pause time shall not exceed 10ms” and “ Support 16TB A pile of ” These two goals have been achieved , And the official made it clear that JDK15 Medium ZGC No longer an experimental garbage collector , And it is suggested to put into production .
4、ZGC Core technology of Technique
4.1 Multiple mapping
Let's first look at an interesting example .
You are a son in the eyes of your parents , In your girlfriend's eyes, it's a boyfriend . In front of people all over the world is the most handsome person . You have another name , But the name is just your code name , It's not you . If your name is the only one in the world , adopt “ What's your name ”、“ Your father's son ”、“ Your girlfriend's boyfriend ”,“ The most handsome man in the world ” It's all about you in the end .
Now let's see ZGC Memory management for .
ZGC The basic unit for managing physical memory in is segment.segment Default and small page size equally , All are 2MB. introduce segment To avoid frequent system calls to request and free memory , An application 2MB, When segment Idle , Will be added to the free list , Wait and reuse .
ZGC In order to be efficient 、 Flexible memory management , Two level memory management is realized : Virtual memory and physical memory , And the mapping between physical memory and virtual memory is realized . This is basically consistent with the design idea of virtual address and physical address in the operating system .
When an application creates an object , First, apply for a virtual address in heap space ,ZGC At the same time, for the object in Marked0、Marked1 and Remapped Each of the three view spaces applies for a virtual address , And these three virtual addresses correspond to the same physical address .
stay ZGC There is only one valid space among the three spaces at the same time .
Why is it so designed ?
This is it. ZGC The brilliance of , Use virtual space for time .
The switching of these three spaces is triggered by different stages of garbage collection , By limiting three spaces to have and only one space at the same time, it can be completed effectively and efficiently GC Concurrent operation of process , This and ZGC Concurrent processing algorithm is related .ZGC The concurrent processing algorithm makes use of the switch between global spatial view and object address view , combination SATB The algorithm achieves efficient concurrency .
4.2 Dye pointer
We all know , Previous garbage collectors used to put GC Information ( Tag information 、GC Generational age ..) There is an object header Mark Word in .
and ZGC Here's how it works :
If an object is a garbage object . Mark this object as garbage in the information of this object . No matter where this object is used in the future , We all know that he is a garbage object .
ZGC Store the object information in the pointer , This technology is called —— Dye pointer (Colored Pointer).
stay 64 In a bit machine , The object pointer is 64 Bit .
ZGC Use 64 Bit address space 0~43 Bit storage object address ,2^44 = 16TB, therefore ZGC The biggest support 16TB A pile of .
And the first 44~47 Bit as a color marker bit ,Marked0、Marked1 and Remapped Represents three view flags ,Finalizable Indicates that this object can only be accessed through finalizer Ability to visit .
The first 48~63 The bit is fixed to 0 There is no use .
4.3 Reading barrier
The reading barrier is JVM The technique of inserting a small piece of code into application code . When an application thread reads an object reference from the heap , It will execute this code . Don't compare this barrier with Java The read barrier in the memory model is confused , The two are not the same thing at all ,ZGC The reading barrier is more like AOP technology , Add an extra processing to the read operation at the bytecode level or at the compile code level .
ZGC As an excellent garbage collector , It draws on Pauseless GC, But in G1 It's not popular today , talk about ZGC It seems too early . But maybe we're not talking about ZGC, It is ZGC The design idea behind it .
Official account + Input [ Interview questions ] + Get the interview materials free of charge ( Interview outline + Interview answers )!
边栏推荐
- 社招面试心得,2022最新Android高频精选面试题分享
- 腾讯安卓开发面试,android开发的基础知识
- 手把手教你学会js的原型与原型链,猴子都能看懂的教程
- 力扣101题:对称二叉树
- 【云小课】EI第47课 MRS离线数据分析-通过Flink作业处理OBS数据
- Poj1149 pigs [maximum flow]
- 腾讯T4架构师,android面试基础
- DOM operation
- Understand yolov1 Part II non maximum suppression (NMS) in prediction stage
- Tencent T2 Daniel explained in person and doubled his job hopping salary
猜你喜欢
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
Example of shutter text component
新一代垃圾回收器—ZGC
Swiftui game source code Encyclopedia of Snake game based on geometryreader and preference
How to customize animation avatars? These six free online cartoon avatar generators are exciting at a glance!
Interview assault 63: how to remove duplication in MySQL?
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发
It's enough to read this article to analyze the principle in depth
[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
随机推荐
POJ 3207 Ikki's Story IV – Panda's Trick (2-SAT)
HDU 1026 Ignatius and the Princess I 迷宫范围内的搜索剪枝问题
数据的同步为每个站点创建触发器同步表
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
Web开发小妙招:巧用ThreadLocal规避层层传值
在解决了 2961 个用户反馈后,我做出了这样的改变...
Tencent Android interview must ask, 10 years of Android development experience
激进技术派 vs 项目保守派的微服务架构之争
[translation] Digital insider. Selection process of kubecon + cloudnativecon in Europe in 2022
Alibaba数据源Druid可视化监控配置
《数字经济全景白皮书》保险数字化篇 重磅发布
MySQL information Schema Learning (i) - - General table
PowerPivot——DAX(初识)
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
Chic Lang: attributeerror: partially initialized module 'CV2' has no attribute 'GAPI_ wip_ gst_ GStreamerPipe
青龙面板白屏一键修复
BUUCTF---Reverse---easyre
Database specific interpretation of paradigm
How to access localhost:8000 by mobile phone
Monthly report of speech synthesis (TTS) and speech recognition (ASR) papers in June 2022