如题,既然如此那我让时间片存在的的意义何在呢?直接顺序执行不就好了?我能想到唯一的好处就是主协程等待其他协程用完,本人刚刚开始自学 go,想到什么问什么,要是比较弱智希望不要喷我。
|
reusOct 15, 2018
1
不知道你在想什么,建议学习操作系统课程,多进程多线程部分,思而不学则殆啊
|
|
mengzhuoOct 15, 2018
3
同 1L 看不懂,应用层程序是不知道时间片存在的。
我猜你是指:runtime.Gosched() https://golang.org/pkg/runtime/#Gosched 文档说得很清楚了。 Gosched yields the processor, allowing other goroutines to run. It does not suspend the current goroutine, so execution resumes automatically. |
|
tourist2018Oct 15, 2018
4
@yangbuwei #2 runtime.Gosched() 单纯这个方法在项目里面用的确实不多 但这是语言特性 你非得和应用结合什么鬼
|
|
5
@tourist2018 我都说了,我刚刚看到那一块,,所以问一下,你回答就回答,秀优越是什么鬼?什么鬼?
|
|
tourist2018Oct 16, 2018
7
@tourist2018 #4 你觉得是秀优越 好吧
|