【JVM】GC 核心关键词

部分信息参考自:马士兵的JVM调优实战

 

 

垃圾回收算法:

1、标记清除   

2、复制:缺点:浪费一半的空间

3、标记压缩(Mark Sweep)

 

对象的产生、分配和回收过程 

TLAB: Thread Local Allocation Buffer:

背景:   对象分配在堆上,而堆是一个全局共享的区域,当多个线程同一时刻操作堆内存分配对象空间时,就需要进行同步,而同步带来的效果就是对象分配效率变差,但是对于存在竞争激烈的分配场合仍然会导致效率变差。
TLAB:提高对象在堆上的分配效率而采用的一种手段,就是给每个线程分配一小块私有的堆空间,即TLAB是一块线程私有的堆空间(实际上是Eden区中划出的)

分代:

Minor GC: 新生代

Major GC: 老年代

Full GC:  新生+老年

 

垃圾回收器:JDK1.8开始支持G1

垃圾回收器发展路线,随着内存越来越大而演进:从分代演化到不分代;  Serial:几十M; Parallel:几个G; CMS: 几十个G

CMS: Concurrent Mark Sweep    第3列:简称PS&PO

Serial:a stop-the-world, copying collector which uses a signle GC thread

Parallel Scavenge:a stop-the-world, copying collector which uses multiple GC thread

Parallel Old:a compacting collector that uses multiple GC threads

 ParNew: a stop-the-world, copying collector which uses multiple GC threads;it differs from "Paralledl Scavenge" in that it has enhancements that makes it useable with CMS(和CMS配对使用); 

For example, ParNew does the synchronization needed so that it can run during the concurrent phases of CMS

CMS: concurrent mark sweep 非常重要的一个算法,面试重灾区;  a mostly concurrent, low-pause collector(暂停时间短)

4 phases:  1.initial mark  2.concurrent mark  3.remark  4.concurent sweep

 

 https://www.bilibili.com/video/BV1AZ4y147fD?p=3

  

posted @ 2020-05-12 00:11  飞翔在天  阅读(177)  评论(0编辑  收藏  举报