[Openmcl-devel] Idle openmcl via slime pin's cpu.

Gary Byers gb at clozure.com
Wed Feb 4 17:21:30 PST 2004



On Wed, 4 Feb 2004, bryan o'connor wrote:

>
> whether process-wait should be pegging the CPU is a different
> question.  some CPU penalty is probably unavoidable.  gary can
> answer to that a lot better than i could.
>
>
> 					...bryan
>

What PROCESS-WAIT's supposed to do is something like:

  (loop
    (when (check-predicate predicate)
      (return))
    (yield-the-rest-of-the-current-thread's-timeslice))

If the OS has other runnable threads, they'll get scheduled without
waiting for our timeslice to expire.  If there are no other runnable
threads most of the time, this'll devolve into something almost as bad
as busy-waiting (though most of the CPU time will likely be spent
busily saying "you know, someone else -could- run now as far as I'm
concerned ...").

The fact that the lisp is being polite when draining the battery and
forcing the fan on is probably a minor consolation.  On the other
hand, the current implementation -does- do a good job of discouraging
the use of PROCESS-WAIT.  (Hmm.  Nah.)

If it slept for a short time instead of "yielding" , it'd conserve
battery life and keep the machine cooler; anyone using PROCESS-WAIT
shouldn't be expecting latency to be that low, anyway.  I'll change
it.






More information about the Openmcl-devel mailing list