I'm wondering why does .NET only offer 5 thread priorities (i.e. highest, aboveNormal, etc.) to choose from if Windows OS uses 32 priorities?

有帮助吗?

解决方案

Windows uses the process priority together with the thread priority to calculate the overall priority. Once you know that, you can google for process priorities and perhaps you find Scheduling Priorities on MSDN.

I would highly appreciate if you could read the book Windows Internals 6th edition, part 1, which describes it in detail on page 410++.

In C# you can try

using System.Diagnostics;
using System.Threading;
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;
Thread.CurrentThread.Priority = ThreadPriority.Highest;

and look at the results with ProcessExplorer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top