cch123 / blog_comment

comments of xargin.com
8 stars 0 forks source link

抢占 | Go 语言笔记 #239

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

抢占 | Go 语言笔记

抢占 # 从 Go 1.14 开始,通过使用信号,Go 语言实现了调度和 GC 过程中的真“抢占“。 抢占流程由抢占的发起方向被抢占线程发送 SIGURG 信号。 当被抢占线程收到信号后,进入 SIGURG 的处理流程,将 asyncPreempt 的调用强制插入到用户当前执行的代码位置。 本节会对该过程进行详尽分析。 抢占发起的时机 # 抢占会在下列时机发生: STW 期间 在 P 上执行 safe point 函数期间 sysmon 后台监控期间 gc pacer 分配新的 dedicated worker 期间 panic 崩溃期间 freezetheworld - preemptall; "debug.WriteHeapDump" - stopTheWorld; "runtime.Stack" -

https://go.xargin.com/docs/runtime/scheduler/preemption/

ghost commented 3 years ago

妙啊~