- 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.
推薦閱讀
- Linux運維實戰:CentOS7.6操作系統從入門到精通
- Containerization with LXC
- Windows Server 2012 Hyper-V:Deploying the Hyper-V Enterprise Server Virtualization Platform
- Red Hat Enterprise Linux 8系統管理實戰
- 白話區塊鏈
- Kali Linux滲透測試全流程詳解
- VMware Horizon View 6 Desktop Virtualization Cookbook
- vSphere Virtual Machine Management
- 異質結原理與器件
- 數據中心系統工程及應用
- jQuery UI Cookbook
- 大學計算機應用基礎實踐教程(Windows 7+MS Office 2010)
- Office 365 User Guide
- 大規模Linux集群架構最佳實踐:如何管理上千臺服務器
- SAP后勤模塊實施攻略:SAP在生產、采購、銷售、物流中的應用