GO进程调度相关源码学习

启动流程

procresize流程

malloc.go

Memory allocator

sizeclass.go

span按大小区分的 类型定义

mbitmap.go

type and heap bitmaps

mgc.go

Garbage collector (GC)

mcache.go

Per-thread (in Go, per-P) cache for small objects.

central.go

Central free lists

mheap.go

Page heap
type mspan struct

//堆结构
struct mheap {
}

mstats.go

Memory statistics

mfixalloc.go

固定尺寸的堆对象空闲列表分配器,用来管理分配器的存储

runtimt2.go

G status,
sudog represents a g in a wait list, such as for sending/receiving on a channel
type g struct
type m struct
type p struct
type schedt struct

1 初始化内存

入口在 runtime/proc.go
schedinit() -> mallocinit()

参考

内存模型

运行时启动过程

调试go程序

posted @ 2018-03-17 22:41  thrillerz  阅读(508)  评论(0编辑  收藏  举报