From 03257374c7b102f603322bddfd6e62b5208da85d Mon Sep 17 00:00:00 2001 From: jiepeng Date: Mon, 26 Apr 2021 14:20:14 +0800 Subject: [PATCH] =?UTF-8?q?Go=201.14=20=E8=B0=83=E5=BA=A6=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appendix/appendix-a-trap.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appendix/appendix-a-trap.md b/appendix/appendix-a-trap.md index 992c977..025c7f8 100644 --- a/appendix/appendix-a-trap.md +++ b/appendix/appendix-a-trap.md @@ -146,7 +146,7 @@ func main() { ## 独占CPU导致其它Goroutine饿死 -Goroutine是协作式抢占调度,Goroutine本身不会主动放弃CPU: +Goroutine 是协作式抢占调度(Go1.14版本之前),Goroutine本身不会主动放弃CPU: ```go func main() { @@ -197,6 +197,8 @@ func main() { } ``` +Go1.14 版本引入基于系统信号的异步抢占调度,可以避免 Goroutine 饿死的情况。 + ## 不同Goroutine之间不满足顺序一致性内存模型 因为在不同的Goroutine,main函数中无法保证能打印出`hello, world`: