System Thread Priority

NTFSD Folk:

I want to have my mini-driver run a system thread “in the background” at low
priority (it’s gonna run for a while).

The only documented routine to change priority is KeSetPriorityThread() and
the only pre-defined priorities are LOW_PRIORITY (0), LOW_REALTIME_PRIORITY
(16), and HIGH_PRIORITY (31). They say that LOW_PRIORITY is reserved for
system use.

Does anyone know if there’s any reason I can’t set a system thread’s
priority to, say, 3?

Ken

I’ve always been under the impression that priorities run from 0 to 31
with 0 reserved for the idle task, 1 through 15 for user stuff and 16+
for system stuff. Normal user (THREAD_PRIORITY_NORMAL) is 3, below
normal is 2 and lowest is 1. (Above normal = 4, highest = 5, etc.)

I’d try to go with 1. If you go with 3, you’re competing with all the
user stuff which is probably not what you want.

Mickey.

Ken Cross wrote:

NTFSD Folk:

I want to have my mini-driver run a system thread “in the background”
at low
priority (it’s gonna run for a while).

The only documented routine to change priority is
KeSetPriorityThread() and
the only pre-defined priorities are LOW_PRIORITY (0),
LOW_REALTIME_PRIORITY
(16), and HIGH_PRIORITY (31). They say that LOW_PRIORITY is reserved for
system use.

Does anyone know if there’s any reason I can’t set a system thread’s
priority to, say, 3?

Ken


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@earthlink.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Close. THREAD_PRIORITY_NORMAL is 4 and THREAD_PRIORITY_BELOW_NORMAL is 3.
That’s why I chose 3.

The real question was: Is there a reason that KeSetPriorityThread() doesn’t
seem to pre-defined priorities below LOW_REALTIME_PRIORITY (16)? It may not
mean a thing – just wondering…

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mickey Lane
Sent: Thursday, August 18, 2005 2:53 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] System Thread Priority

I’ve always been under the impression that priorities run from 0 to 31
with 0 reserved for the idle task, 1 through 15 for user stuff and 16+
for system stuff. Normal user (THREAD_PRIORITY_NORMAL) is 3, below
normal is 2 and lowest is 1. (Above normal = 4, highest = 5, etc.)

I’d try to go with 1. If you go with 3, you’re competing with all the
user stuff which is probably not what you want.

Mickey.

Ken Cross wrote:

NTFSD Folk:

I want to have my mini-driver run a system thread “in the background”
at low
priority (it’s gonna run for a while).

The only documented routine to change priority is
KeSetPriorityThread() and
the only pre-defined priorities are LOW_PRIORITY (0),
LOW_REALTIME_PRIORITY
(16), and HIGH_PRIORITY (31). They say that LOW_PRIORITY is reserved for
system use.

Does anyone know if there’s any reason I can’t set a system thread’s
priority to, say, 3?

Ken


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@earthlink.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Wait, wait.

OK, it depends on the Process Priority Class. A “normal” process uses
either “Background NORMAL_PRIORITY_CLASS” (where THREAD_PRIORITY_NORMAL is 7
and THREAD_PRIORITY_BELOW_NORMAL is 6) or “Foreground NORMAL_PRIORITY_CLASS”
(where THREAD_PRIORITY_NORMAL is 9 and THREAD_PRIORITY_BELOW_NORMAL is 8).
Clear as mud?

Anyhow, running at priority 3 shouldn’t bother anybody except when it does
I/O.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mickey Lane
Sent: Thursday, August 18, 2005 2:53 PM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] System Thread Priority

I’ve always been under the impression that priorities run from 0 to 31
with 0 reserved for the idle task, 1 through 15 for user stuff and 16+
for system stuff. Normal user (THREAD_PRIORITY_NORMAL) is 3, below
normal is 2 and lowest is 1. (Above normal = 4, highest = 5, etc.)

I’d try to go with 1. If you go with 3, you’re competing with all the
user stuff which is probably not what you want.

Mickey.

Ken Cross wrote:

NTFSD Folk:

I want to have my mini-driver run a system thread “in the background”
at low
priority (it’s gonna run for a while).

The only documented routine to change priority is
KeSetPriorityThread() and
the only pre-defined priorities are LOW_PRIORITY (0),
LOW_REALTIME_PRIORITY
(16), and HIGH_PRIORITY (31). They say that LOW_PRIORITY is reserved for
system use.

Does anyone know if there’s any reason I can’t set a system thread’s
priority to, say, 3?

Ken


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@earthlink.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

> I’ve always been under the impression that priorities run from 0 to 31

with 0 reserved for the idle task, 1 through 15 for user stuff and 16+ for
system stuff. Normal user (THREAD_PRIORITY_NORMAL) is 3, below normal is 2
and lowest is 1. (Above normal = 4, highest = 5, etc.)

ISTR that 16+ is a ‘real time’ prority (just like VMS!). According to
Viscarola & Mason, threads of such a priority don’t get priority boost on
IO completion and (again like VMS) are not subject to pre-emption (I
remember setting the null process to priority 16 in an early VMS version,
that’s another story, but it taught me to take care with priority >= 16)

/r

> ISTR that 16+ is a ‘real time’ prority (just like VMS!). According to

Viscarola & Mason, threads of such a priority don’t get priority boost on
IO completion and (again like VMS) are not subject to pre-emption (I
remember setting the null process to priority 16 in an early VMS version,
that’s another story, but it taught me to take care with priority >= 16)

…are not subject to preemption due to quantum end only. Timeslicing does
not work for them. The higher-priority thread awakening still preemts them.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com