首页 > 解决方案 > Can low priority I/O threads block the high priority threads?

问题描述

I am following the book CLR via C# by Jeffrey Richter. With regards to I/O request priorities it says:

Because I/O requests typically require time to process, it is possible that a low-priority thread could significantly affect the responsiveness of the system by suspending high-priority threads, which prevents them from getting their work done

However, Microsoft's documentation about Scheduling Threads states that:

If a higher priority thread becomes runnable, the lower priority thread is preempted and the higher priority thread is allowed to execute once again

Even Jeff's own book states the following about thread scheduling:

Higher-priority threads always preempt lower-priority threads, regardless of what the lower-priority threads are executing. For example, if a priority 5 thread is running and the system determines that a higher-priority thread is ready to run, the system immediately suspends the lower-priority thread (even if it’s in the middle of its time-slice) and assigns the CPU to the higher-priority thread, which gets a full time-slice.

Based on the above, I understand that whenever a low priority thread performing I/O operation is running and a higher priority thread is in the runnable state, the higher priority thread is executed suspending the I/O thread temporarily. How is it possible for the low priority I/O threads to suspend the high priority threads?

标签: .netmultithreadingclr

解决方案


推荐阅读