Process Priority is everything.
Did you know that the default Process Priority of a scheduled Task in Windows is below normal?
No? me either.
You may know the following scenario. You have a few scheduled Task like a daily Robocopy job, and you are wondering why the run time is growing every day.
We had that problem too. Our Problem was that a Robocopy Process took more than 2 Days to mirror just a bunch of folders on our Fileserver.
The Problem was, that every night when our Robocopy Process was running, a second Indexing Process from a third party tool came up, to update its Database by re-indexing the fileserver folders. During that time, the Robocopy Process was nearly on hold.
But why? After a few tests i saw that the Robocopy Process was started with a lower Priority than normal. Our Robocopy Process was waiting until it got some free Resources from our System.
I didn’t know that Windows set the Default Process Priority from a scheduled Task to “Below Normal”.
I also checked inside the Windows Task Scheduler if i could change the Priority Level, but there is no way to override this from the Task Scheduler GUI.
The solution is quite simple.
So there is no way to change the Priority level inside the GUI. The only possibility to do that is to Export your Scheduled Task as an XML file.
Open that file with an Text Editor and search for the “Priority Key” value in it.
This value is set to “7” by default, and 7 means “Below Normal”(see List)
Task priority | Priority Class | Priority Level |
---|---|---|
0 | REALTIME_PRIORITY_CLASS | THREAD_PRIORITY_TIME_CRITICAL |
1 | HIGH_PRIORITY_CLASS | THREAD_PRIORITY_HIGHEST |
2 | ABOVE_NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_ABOVE_NORMAL |
3 | ABOVE_NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_ABOVE_NORMAL |
4 | NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_NORMAL |
5 | NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_NORMAL |
6 | NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_NORMAL |
7 | BELOW_NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_BELOW_NORMAL |
8 | BELOW_NORMAL_PRIORITY_CLASS | THREAD_PRIORITY_BELOW_NORMAL |
9 | IDLE_PRIORITY_CLASS | THREAD_PRIORITY_LOWEST |
10 | IDLE_PRIORITY_CLASS | THREAD_PRIORITY_IDLE |
Source: Microsoft MSDN
Just change the Value to 5 or below to set the Process to a Normal or High Priority. After you saved the XML File, just import it into the Windows Task Scheduler. After makting these changes, our Robocopy finished its job during 2 hours.
I have no clue why Microsoft haven’t made a simple Filed inside the GUI to change the Process Priority.
It could be so easy.
Leave a Reply