gpt4 book ai didi

go - Golang 如何为 goroutines 实现 OS 线程?

转载 作者:IT王子 更新时间:2023-10-29 02:22:50 26 4
gpt4 key购买 nike

我试图弄清楚 golang 如何将 goroutine 多路复用到 OS 线程上,但我在 golang 源代码中找不到它的实现。我查看了 proc.go 和 runtime.go。我想知道线程是如何初始化和管理的,以及它是否使用 pthreads。

最佳答案

每个操作系统的策略都不同。
一些示例在 the windows os portion for the Go runtime 中和 the linux os portion for the Go runtime

关于go - Golang 如何为 goroutines 实现 OS 线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39256491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com