官术网_书友最值得收藏!

OS thread or machine

Initially, the OS threads or machines are created by and managed by the OS. Later on, the scheduler can request for more OS threads or machines to be created or destroyed. It is the actual resource upon which a goroutine will be executed. It also maintains information about the main goroutine, the G currently being run on it, thread local storage (tls), and so on:

// Denoted as M in runtime 
type m struct { 
    g0               *g         // goroutine with scheduling stack 
    tls               [6]uintptr // thread-local storage (for x86 extern register) 
    curg            *g         // current running goroutine 
    p                 puintptr   // attached p for executing go code (nil if not executing go code) 
    id                 int32 
    createstack [32]uintptr // stack that created this thread. 
    spinning      bool        // m is out of work and is actively looking for work 
 
    // ... 
} 
主站蜘蛛池模板: 综艺| 济阳县| 兴安盟| 扶绥县| 茂名市| 东源县| 茌平县| 丹寨县| 益阳市| 嘉兴市| 正镶白旗| 文化| 纳雍县| SHOW| 北流市| 嫩江县| 同心县| 九龙坡区| 修水县| 华坪县| 丹阳市| 黄龙县| 龙江县| 汝南县| 时尚| 太原市| 宝丰县| 岐山县| 黔江区| 常州市| 长顺县| 介休市| 讷河市| 夏津县| 黄浦区| 长乐市| 广东省| 云浮市| 新安县| 申扎县| 共和县|