当前位置:网站首页>Synchronized detailed parsing

Synchronized detailed parsing

2022-06-09 05:42:00 Cat cat God

1. We all know that the code we write will be compiled to jvm management , How to manage it ? There must be something to add

This thing is the object header , Mark something , For example, today's lock , also gc Related things Here's the picture

 Insert picture description here

2.jvm How to write

        Omit ... I don't want to find ...( I guess I can't remember later )

3.synchronized The lock has an upgrade process , From no lock --》 Biased locking --》 Lightweight lock ---》 Heavyweight lock , According to the above process Summarize the process

3.1) Bias lock process

 

3.2) Lightweight lock

 

 

 

 3.3) Heavyweight lock

Lock process

 

  Exit process

 

原网站

版权声明
本文为[Cat cat God]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090529559211.html