golang concurrency model

CSP concurrency model (using communication means to share memory)
-Concurrent entities, usually can be understood as execution threads, they are independent of each other, and execute concurrently;
-Channels, concurrent entities use channels to send information.

The user thread cannot be perceived by the operating system, and the process or kernel thread to which the user thread belongs can be directly scheduled by the operating system to allocate CPU usage time. Different threading models have been derived from this, and the usage of CPU resources between them has its advantages and disadvantages.

insert image description here
machine, a machine corresponds to a kernel thread, which is equivalent to the mapping processor of the kernel thread in the Golang process
, and a prcessor represents the necessary context for executing Go code fragments
. The encapsulation of code fragments is actually a lightweight user thread.

Process state transition three-state diagram
ready-running-blocking

Guess you like

Origin blog.csdn.net/qq_34751210/article/details/127769692