Skip to content

Commit 92751ab

Browse files
authored
Merge pull request #10 from frankxjkuang/patch-1
Update 2、Golang的协程调度器原理及GMP设计思想?.md
2 parents b9d509f + fe1d0e8 commit 92751ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

2、Golang的协程调度器原理及GMP设计思想?.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ G2创建G8时,P1的本地队列未满,所以G8会被加入到P1的本地队
544544
M2尝试从全局队列(简称“GQ”)取一批G放到P2的本地队列(函数:`findrunnable()`)。M2从全局队列取的G数量符合下面的公式:
545545

546546
```go
547-
n = min(len(GQ)/GOMAXPROCS + 1, len(GQ/2))
547+
n = min(len(GQ)/GOMAXPROCS + 1, len(GQ)/2)
548548
```
549549

550550
至少从全局队列取1个g,但每次不要从全局队列移动太多的g到p本地队列,给其他p留点。这是**从全局队列到P本地队列的负载均衡**

0 commit comments

Comments
 (0)