5

安全区域该怎么理解?

 3 years ago
source link: https://www.v2ex.com/t/791427
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Java

安全区域该怎么理解?

  zhao1014 · 19 小时 42 分钟前 · 528 次点击

处于非执行状态的线程,例如 BLOCKED 、SLEEP 状态,无法响应虚拟机的中断请求,不能执行到安全点挂起,所以引入了安全区域。

不过处于这种状态的线程本身就不会导致引用关系发生改变吧?这个安全区域就是线程挂起时给虚拟机发个通知,线程恢复时检查枚举根节点是否结束,这样理解对吗?

书里说安全区域是一段代码,执行这段代码时引用关系不会发生变化,搞得我有点转不过来弯,已经挂起的线程还怎么执行到安全区域?让线程挂起的代码段就是安全区域的意思吗?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK