tiancaiamao
深入解析Go

Updated 3 years ago

g10guang (@g10guang) started discussion #25

2 years ago · 0 comments

Open

schedule函数绝不返回,它会根据当前线程队列中线程状态挑选一个来运行。由于当前只有这一个goroutine,它会被调度,然后就到了runtime.main函数中来,runtime.main会调用用户的main函数,即main.main从此进入用户代码。前面已经写过helloworld了,用gdb调试,一步一步的跟踪观察这个过程。

系统初始化 (Edit this file)

具体哪个线程会执行应该是操作系统调度的吧。这里应该是挑选 goroutine 在线程池中挑选一个线程执行 goroutine

No description provided.

No comments on this discussion.


to join this conversation on GitBook. Already have an account? Sign in to comment
Notifications

You’re not receiving notifications from this thread.


1 participant