[Openmcl-devel] Freeze
Gary Byers
gb at clozure.com
Mon Jun 2 18:26:57 PDT 2008
Enclosed is an equally stupid C version of the same code. To compile
it, do:
shell> cc -o stupid stupid stupid.c -lpthread
and to run it:
shell> ./stupid
If you're lucky, you'll be able to interrupt it via ^C at the point
where things become intolerable but before they become hopeless. If
you're unlucky, you may need to reboot (so don't try this unless you're
prepared to do that.)
I'm sure that with a little thought we can convince ourselves that
trying to schedule N compute-bound threads on M CPUs can't work too
well if N is significantly greater than M. Long before any other
resources get exhausted, the likelyhood of any thread in the system
getting scheduled and getting enough of a time slice to do anything
useful becomes very small. In both Peter's example and the C example
above, the factor that keeps the OS from running out of resources
(memory for stacks, kernel and other resources) before the system
becomes totally unusable is the fact that the thread that's sitting
in a loop creating other threads doesn't get much CPU time: the
time it takes to create a thread increases (and the rate at which
threads can be created therefore decreases) pretty dramatically
and pretty quickly.
If anyone thinks that compute-bound threads don't compete with
each other for CPU time, Peter's example is a convincing demonstration
to the contrary; if anyone thinks that this has much to do with CCL
or lisp, I hope that my example will be equally dissuasive.
Since I'd be surprised if too many people believe that, I'm not
sure what other value either example has.
On Mon, 2 Jun 2008, p2.edoc at googlemail.com wrote:
> This repeatedly freezes the whole machine (a G5 quad), needing a power reboot.
>
> Welcome to Clozure Common Lisp Version 1.2-r9226-RC1 (DarwinPPC32)!
> ? (defun stress-test ()
> (loop for n from 1 do
> (process-run-function (format nil "Stress ~D" n)
> #'(lambda () (loop do (1+ 1))))))
> STRESS-TEST
> ? (stress-test)
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stupid.c
Type: text/x-csrc
Size: 443 bytes
Desc:
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20080602/c1e85e54/attachment.bin>
More information about the Openmcl-devel
mailing list