SMP and setrunnable()- scheduler 4bsd

John Baldwin jhb at
Tue Jul 8 15:37:31 PDT 2003

On 08-Jul-2003 Julian Elischer wrote:
> It looks tp me that if we make a thread runnable
> and there is a processor in the idle loop, the idle processor should be
> kicked in some way to make it go get the newly runnable thread.
> If the processors are halting in the idle loop however, it may take
> quite a while for the new work to be noticed..
> (possibly up to milliseconds I think)
> Is there a mechanism to send an IPI to particular processors?
> or is it just broadcast?  
> I think we would be better served to alter idle_proc(void *dummy)
> (or maybe choosethread()) to increment or decrement a count
> of idle processors (atomically of course) so that 
> setrunnable (or it's lower parts) can send that IPI
> and get the idle processor into actioan as soon as a thread is
> available.
> I have not seen any such code but maybe I'm wrong....

This is why HLT is not enabled in SMP by default (or at least was,
it may be turned on now).  Given that the clock interrupts are
effectively broadcast to all CPU's one way or another for all
arch's (that I know of), you will never halt more than the interval
between clock ticks on any CPU.


John Baldwin <jhb at>  <><
"Power Users Use the Power to Serve!"  -

More information about the freebsd-current mailing list