[Linux] coroutine is not what I think of this

The concept is the earliest known processes, each of which is a thread of execution units, a process must have a main thread, you can also set out a number of sub-thread, maybe all operating systems control

 

Coroutine is what concept?

Now the thread which adds a coroutine unit, this is the concept of each program themselves to achieve, is smaller than the thread of a unit

 

If you turn in a thread inside a coroutine, the main thread will be blocked to go inside a coroutine, coroutine executed, and then back to the main thread. This is good] and blocking is not the same thread, the thread is being operated kernel blocked, and be programmed coroutine is blocked, does not enter the operating system kernel, so that less resource-intensive.

 

Multi-process and multi-threaded switches, are needed to deal with the operating system, if replaced multiprotocol switching process, can we just need to deal with their own procedures on the line, consuming less resources.

 

So for many languages ​​such as PHP concepts have coroutines should be coroutines single, and did not increase the number of concurrent scheduling coroutine switch

 

 

Guess you like

Origin www.cnblogs.com/taoshihan/p/12614646.html