- Notifications
You must be signed in to change notification settings - Fork3.2k
appendix/appendix-a-trap#594
-
appendix/appendix-a-trapGo语言高级编程 https://chai2010.cn/advanced-go-programming-book/appendix/appendix-a-trap.html |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Replies: 1 comment 4 replies
-
不同Goroutine之间不满足顺序一致性内存模型 |
BetaWas this translation helpful?Give feedback.
All reactions
-
不同Goroutine之间不满足顺序一致性内存模型 这个例子 var msg string func setup() { func main() { |
BetaWas this translation helpful?Give feedback.
All reactions
-
这个例子 我的go版本是1.16.6 是可以稳定输出"hello, world"的 |
BetaWas this translation helpful?Give feedback.
All reactions
-
多核CPU,可能出现协程a更改的变量,比如msg,在更新到内存前,就被b协程读到了 |
BetaWas this translation helpful?Give feedback.
All reactions
-
在多核处理器的计算机上,main Goroutine 和 setup Goroutine 可能在不同的处理器核心上并发执行。每个处理器核心都有自己的缓存,当执行程序时,处理器可能会将一些变量缓存在处理器的寄存器或本地缓存中,而不是立即将它们写回主内存。因此,不同 Goroutine 之间可能会看到不一致的内存状态。 |
BetaWas this translation helpful?Give feedback.
All reactions
😄 1