Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top