当前位置:网站首页>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 )!
边栏推荐
- mod_ WSGI + pymssql path SQL server seat
- 爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
- 夏志刚介绍
- 语音识别(ASR)论文优选:全球最大的中英混合开源数据TALCS: An Open-Source Mandarin-English Code-Switching Corpus and a Speech
- Method keywords deprecated, externalprocname, final, forcegenerate
- OceanBase社区版之OBD方式部署方式单机安装
- Hudi vs Delta vs Iceberg
- Analysis of rainwater connection
- Systematic and detailed explanation of redis operation hash type data (with source code analysis and test results)
- Cesium 两点之间的直线距离
猜你喜欢
案例 ①|主机安全建设:3个层级,11大能力的最佳实践
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
[calculating emotion and thought] floor sweeper, typist, information panic and Oppenheimer
Information System Project Manager - Chapter VIII project quality management
Leetcode 30. Concatenate substrings of all words
redisson bug分析
Pay attention to the partners on the recruitment website of fishing! The monitoring system may have set you as "high risk of leaving"
2022年6月语音合成(TTS)和语音识别(ASR)论文月报
深入浅出,面试突击版
BUUCTF---Reverse---easyre
随机推荐
Test Li hi
Yyds dry goods inventory leetcode question set 751 - 760
算法面试经典100题,Android程序员最新职业规划
Poj3617 best cow line
AsyncHandler
How to access localhost:8000 by mobile phone
350. 两个数组的交集 II
Tencent T3 teaches you hand in hand. It's really delicious
Tencent T2 Daniel explained in person and doubled his job hopping salary
OceanBase社区版之OBD方式部署方式单机安装
MySQL must know and learn
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
mod_wsgi + pymssql通路SQL Server座
MySQL information Schema Learning (i) - - General table
Interview assault 63: how to remove duplication in MySQL?
新一代垃圾回收器—ZGC
在解决了 2961 个用户反馈后,我做出了这样的改变...
Microservice architecture debate between radical technologists vs Project conservatives
Leetcode 30. Concatenate substrings of all words
腾讯字节等大厂面试真题汇总,网易架构师深入讲解Android开发