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

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 
 
    // ... 
} 
主站蜘蛛池模板: 黄山市| 安乡县| 永修县| 高台县| 梓潼县| 西峡县| 临汾市| 夹江县| 沾化县| 尼勒克县| 马尔康县| 乐清市| 乐山市| 吉木乃县| 台中县| 珠海市| 金寨县| 南漳县| 中西区| 庆阳市| 东丽区| 郑州市| 枝江市| 安康市| 青龙| 邯郸市| 高阳县| 卢龙县| 枣强县| 松原市| 东宁县| 唐河县| 汉川市| 芦溪县| 拜泉县| 宁武县| 伊宁市| 勐海县| 龙门县| 崇明县| 扎赉特旗|