* Instead of choosing the next thread if we skip one, we now choose the first thread

with a lower priority than the current one.
* Further reduced the probability to skip a thread to roughly 4%, that makes around
  13 skips per second, and about 40 msecs spend in lower priority threads per second
  (with a 3 msec quantum). Might still be too much, but we'll see.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19719 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-06 12:50:01 +00:00
parent 97ad772ada
commit ddcd53aaf0
+9 -4
View File
@@ -197,12 +197,17 @@ scheduler_reschedule(void)
if (nextThread->queue_next && nextThread->queue_next->priority == B_IDLE_PRIORITY)
break;
// skip normal threads sometimes (roughly 12.5%)
if (_rand() > 0x1000)
// skip normal threads sometimes (roughly 4%)
if (_rand() > 0x500)
break;
prevThread = nextThread;
nextThread = nextThread->queue_next;
// skip until next lower priority
int32 priority = nextThread->priority;
while (nextThread->queue_next && priority == nextThread->queue_next->priority
&& nextThread->queue_next->priority > B_IDLE_PRIORITY) {
prevThread = nextThread;
nextThread = nextThread->queue_next;
}
}
}