Re: thread priority



[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
.



Relevant Pages

  • Re: Queuing and Prioritization with PF
    ... I've read up on Class Based Queuing and Priority ... ALL packets with higher priority before ANY of the lower-priority ... I just want ssh to have a higher priority. ...
    (freebsd-questions)
  • Queuing and Prioritization with PF
    ... I've read up on Class Based Queuing and Priority ... ALL packets with higher priority before ANY of the lower-priority ... I just want ssh to have a higher priority. ...
    (freebsd-questions)
  • Iptables :: priority of rules
    ... I don't understand how the priority of the rules of iptables is set. ... I want to allow ssh from my local network, and from outside only for an IP ... If I switch the two rules, ...
    (Fedora)
  • [ckpatch][3/29] 2.6.17-smpnice-staircase-16
    ... Implement the "staircase" hybrid foreground-background single priority ... array cpu scheduler policy. ... extern struct user_struct root_user; ... goto out_running; ...
    (Linux-Kernel)
  • [RFC][PATCH] O(1) Entitlement Based Scheduler
    ... This patch is a modification of the Oscheduler that introduces ... _entitlement_ to CPU resources that is determined by the number of _shares_ ... This patch provides both soft and hard CPU usage rate caps per ... one getting the most can be given a better priority, ...
    (Linux-Kernel)

Loading