Re: thread priority
- From: Ilya Zakharevich <nospam-abuse@xxxxxxxxx>
- Date: Tue, 21 Mar 2006 01:02:25 +0000 (UTC)
[A complimentary Cc of this posting was sent to
<tholen@xxxxxxxxxxxx>], who wrote in article <kKGTf.7973$w86.2308@xxxxxxxxxxxxxxxxxxxx>:
Just witnessed an unexpected situation. Had two number-crunching
processes running in the background with equal thread priority.
Each was getting approximately 50 percent of the CPU time, as
expected.
Why would you expect it? It good if it happens, but the process
dispatcher logic is so compicated, that one cannot predict the time
share of equal-actual-priority threads. And you never know how
requested priority will be mapped to actual priority.
But then I fired up SSH and watched in amazement as one
of the two background number-crunching processes got essentially
100 percent of the CPU. Exited SSH, went back to 50/50. Started
SSH again, went to 100/0. Process with the lower PID was favored.
Any ideas why SSH should cause that?
One possible explanation: SSH has a higher priority thread. It is
always ready at beginning of the next timeslice, it it preempts the
currently running thread. It immediately returns control (DosSleep(1)
or some such); the lower-PID thread starts. Repeat.
The net result is that higher-PID thread has no chance of running.
[Of course, this assumes some particular details of dispatcher logic
to suit your scenario.]
Hope this helps,
Ilya
.
- References:
- thread priority
- From: tholen
- thread priority
- Prev by Date: thread priority
- Next by Date: Re: Doodles Screensaver
- Previous by thread: thread priority
- Index(es):
Relevant Pages
|
Loading