Does a thread waiting for IO also block the kernel?

In a synchronous / blocking computation model, we usually say that the thread will wait (to be blocked) while it waits for the I / O task to complete.

My question is that this usually causes the CPU core that is executing the thread to not work, or the thread that is waiting for input to the IO, usually shuts down in context and is put in a wait state until the IO will be ready for processing?

+4
source share
2 answers

The processor core is usually not designed for one specific thread of execution. The kernel constantly switches processes running on and off the CPU. The process currently being executed by the processor is in the "running" state. The list of processes awaiting their turn is in a "ready" state. The kernel switches them quickly and quickly. Modern processor functions (multiple cores, simultaneous multithreading, etc.) Try to increase the number of execution threads that can be physically executed immediately.

I/O, ​​ ( ) CPU. - , ​​ , ( "" ) CPU.

, : . .

+12

, , , , .

CPU () 1 , . , . question:

SetProcessAffinityMask , , , "" , , (, , SetThreadAffinityMask , ).

0

All Articles