Location>code7788 >text

Go runtime scheduler in a nutshell (XI): the big picture

Popularity:226 ℃/2024-09-19 11:23:46

0. Preface

The previous ten lectures introduced the Go runtime scheduler, and this lecture provides a general overview of the Go runtime scheduler along with some diagrams.

1. State transition diagrams

First is the state transition diagram of the Goroutine:

image

Most of the transfer paths have also been described in previous lectures and will not be continued here (below).

Next is the state transfer diagram for P:

image

Finally, there is a state transfer diagram for thread M:

image

Note: The above pictures are from the public number [code farmer peach blossom source], Rao Da painting is too good, directly let people do not want to paint. Very good public number, full of dry goods, logical, clear, and occasionally witty humor, recommended oh.

2. GPM

2.1 GPM Workflow

Straight to the picture:

image

This image is from senior Gopher Cao Da, whose site is athere areRecommended.

2.2 Scheduling process

image

Click here to see ->Dynamic Demonstration Chart

This image and animation is also from Cao Da Haha

3. Summary

This is basically the end of the Go runtime scheduler presentation, I hope you have learned something from these lectures, thanks for your company, see you soon.

4. References

  • go language scheduler source code scenario analysis
  • The Go scheduler
  • Go Wiki: Debugging performance issues in Go programs
  • goroutine scheduler
  • Advanced Programming in Go