thread priority

K

Kovan Akrei

Hi,
I know that thread priority in dot Net might not be respekted by an
operating system. How does windows (2000 and xp) react to thread priority in
dot Net. For instance will a thread which has a priority above normal be
garantied cpu time before a a thread with a normal priority?

Regards from
Kovan
__________________________________________________________________ R u
kidding me Ya right ICQ#: 149146797 Current ICQ status: + More ways to
contact me
__________________________________________________________________
 
A

Alvin Bruney

It's not an iron-clad guarantee. Think of it as a recommendation. The
operating system decides what is best given a specific context. Usually, the
recommendation is honored, there are times when it is not so you should not
write code which depends on this implicit assumption. Write your code as if
it were a recommendation to the OS instead and you will be ok
 
D

Dave

The Windows OS dispatcher determines what thread should run next. Thread
priority is determined by two basic factors; the base priority of the
process and the relative priority of the thread. A runnable thread of higher
priority will always be dispatched before a runnable thread of lower
priority. Threads of the same priority will be scheduled to run in a
round-robin manner. A thread will run until either its quantum has expired
or it is no longer runnable (it blocks, sleeps, etc).

Currently thread priorities in .net are mapped directly to thread priorities
in the underlying OS, so you should get the behavior supplied by the OS. For
details on how the scheduler works you should consult the MSDN docs on
dispatching/scheduling.
 
A

Alvin Bruney

Dave,
that's correct. I said it was a recommendation only because I do not
normally know or care about the process priority. Which means that
scheduling a thread as high priority on a low priority process will lead to
unexpected results for me. I'm safer, i think, assuming that it is a
recommendation to be honored by the scheduler based on - among other
things - process priority. But again you are technical spot on with your
explanation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top