抢占 | Go 语言笔记
- Dominant language
- No language data
- Stars
- 8
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
# 抢占 | 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/](https://go.xargin.com/docs/runtime/scheduler/preemption/)
Contributor guide
No contributing guide indexed for this repository
Research direction
No repository file or test is named. Start by reading the linked Go preemption article and inspect how this repository stores blog comments; clarify whether the intended work is a correction, expansion, or new documentation. Done means an agreed, reviewable documentation change with a defined location and scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100