- Distributed Computing with Go
- V.N. Nikhil Anurag
- 151字
- 2021-06-24 18:36:11
Context or processor
We have a global scheduler which takes care of bringing up new M, registering G, and handling system calls. However, it does not handle the actual execution of goroutines. This is done by an entity called Processor, which has its own internal scheduler and a queue called runqueue (runq in code) consisting of goroutines that will be executed in the current context. It also handles switching between various goroutines and so on:
// Denoted as P in runtime code type p struct { id int32 m muintptr // back-link to associated m (nil if idle) runq [256]guintptr //... }
From Go 1.5 onwards, a Go runtime can have a maximum number of GOMAXPROCS Ps running at any given point in the program's lifetime. Of course, we can change this number by either setting the GOMAXPROCS environment variable or by calling the GOMAXPROCS() function.
推薦閱讀
- 全屋互聯:智能家居系統開發指南
- Implementing Cisco UCS Solutions
- 開源安全運維平臺OSSIM疑難解析:入門篇
- SharePoint 2013 WCM Advanced Cookbook
- Android物聯網開發細致入門與最佳實踐
- 蘋果OS X Mavericks 10.9應用大全
- Linux命令行大全(第2版)
- 計算機系統:基于x86+Linux平臺
- 操作系統分析
- Learn SwiftUI
- Mastering Windows 8 C++ App Development
- 統信UOS應用開發進階教程
- 應急指揮信息系統設計
- VMware vSphere 5.1 Cookbook
- Angular權威教程