How to change I/O priority of a process or thread in Win7?

32

7

Process Explorer is able to show the effective IO priority of a given thread, but not change it. Seeing as IO priority support is a comparatively new feature, most programs don't set their own IO priorities. It appears that by default the IO priority is derived from the thread priority (rather than process priority), which Process Explorer can't modify either.

Are there any other tools out there that can help me change the IO priority of a given thread / all threads of a given process?

RomanSt

Posted 2010-04-29T16:49:11.717

Reputation: 7 830

There is almost the same question on Stack Overflow: http://stackoverflow.com/questions/301290/how-can-i-o-priority-of-a-process-be-increased

– Mehper C. Palavuzlar – 2010-04-30T06:34:21.387

3@[Mehper C. Palavuzlar] true, but this is not for software I develop - I'm looking for a ready-made tool to do this on third-party software. – RomanSt – 2010-05-10T10:58:29.580

Answers

11

Ready-Made Tool

A third-party tool to set process I/O priorities, either by manual user action or automation and persistence, would be Process Lasso. It can set almost any process setting, and do so persistently, or by rules (e.g. when this happens, change I/O priority of that).

Programmatic Answer

The answer is a simple API call to an NT Native API, NTSetInformationProcess. It is defined as the class 'IoPriority' in the 2008 DDK. In NT6 only two levels supported: Very Low (background) and Normal. There are technically 5 levels defined -- Critical, High, Normal, Low, and Very Low. The Critical level is reserved for paging operations. No data on the others.

However, the proper way to use the I/O priority is only to start a 'background mode' via a call to the Windows API SetProcessPriorityClass, supplying PROCESSS_MODE_BACKGROUND_BEGIN. This will cause it to use the very Low (background) I/O priority, along with an IDLE CPU priority class. When done, revert via PROCESS_MODE_BACKGROUND_END.

The SetThreadPriority API will also allow this same background mode for specific threads. Here you'd supply THREAD_MODE_BACKGROUND_BEGIN/END.

dyasta

Posted 2010-04-29T16:49:11.717

Reputation: 288

That's not "a ready-made tool to do this on third-party software." – Cees Timmerman – 2014-07-16T14:12:13.153

Sorry, I think the question may have been edited, as clearly I was answering from a programmatic side (not edited). Process Lasso is a 'ready-made tool to do this on third-party software'. See https://bitsum.com

– dyasta – 2016-06-22T13:57:33.173

I'm not into windows programming and OS level stuff, but i've heard of bumping the priority of a thread, all the way up to THREAD_PRIORITY_TIME_CRITICAL is that possible with your program or any program? or is it still only IO PRIORITY that can be adjusted, and not thread cpu priority? I guess changing IO priority won't make much difference to CPU Usage, right? – barlop – 2012-12-14T10:23:41.303

Yes. Both can be set, and persist. Many other things can also be set, or dynamically changed based on rules (e.g. CPU affinity). I/O priority is distinct from CPU priority, right. – dyasta – 2013-04-04T22:02:15.950

23

I developed this after seeing nobody bothered with it: https://sourceforge.net/projects/iopriority/ (open source)

This program is able to set the I/O priority of a process, and all threads are being affected by it immediately. It's pretty easy to modify it to work with threads instead of processes.

Wye

Posted 2010-04-29T16:49:11.717

Reputation: 239

1I just noticed you don't allow it to change a process to a High priority on Server 2012R2. – jftuga – 2014-12-11T19:28:03.680

14

ProcessHacker is a GUI tool that can change IO priority of an arbitrary process.

RomanSt

Posted 2010-04-29T16:49:11.717

Reputation: 7 830

Why does it look like something Russinovich did? – Daniel Mošmondor – 2013-09-14T10:11:08.137

1@DanielMošmondor Maybe it was inspired by ProcExp and its limitations? I personally switched because ProcExp showed completely wrong CPU usage on my laptop after version 14. – RomanSt – 2013-09-16T16:50:24.487

1Not only that, ProcExp was also able to BSOD my comp, etc. Is it free? – Daniel Mošmondor – 2013-09-16T17:38:18.183

@DanielMošmondor Yes, moreover it actually seems to do more than ProcExp in every way. Slightly different UI but very capable indeed. – RomanSt – 2013-09-16T18:12:55.043

1

I'm partial to a free app called PRIO, which is a process priority saver (among other things) with a very small ( less than 1 MB) footprint. After installation it runs silently in the background until you need it, and its interface builds directly into the Windows Task Manager, extending its functionality and making it as if the added features were always part of Task Manager. When you right-click a process in Task Manager with the intent of changing its priority, some of PRIO's added features become apparent, as you can change not only the process' CPU priority but its I/O priority as well (ergo your question), and you can choose to SAVE the new settings if you so desire. This last makes it so that every time that process ( i.e.  that program) is run, both the CPU and I/O process priorities set and saved by you will come into effect.

The app has other features that also extend the functionality of the various tabs in the Windows Task Manager. Versions exist for both 32- and 64-bit systems, and the app is free for personal use.

Mike Mounier

Posted 2010-04-29T16:49:11.717

Reputation: 327

Sounds like a great app. Got a link? – Stijn de Witt – 2017-05-31T17:40:13.090

1

If you mean PRIO, it's available from a number of different content aggregators (like cnet), but directly from the developer's website would be https://www.prnwatch.com/prio/

– Mike Mounier – 2017-06-02T01:19:58.793