Threading...
(sorry for the double submission, but I think the first will bounce from an unrecognized e-mail address...)
Here is a revised piece of junk-code to prevent permanent lock-up of the system, and to further illustrate the behavior of the thread control mechanism...
After compiling the code, then executing the launcher in the comment block at the bottom, this code runs for several seconds on my Mac -- long enough for hundreds of potential time slices to occur.
I launch from a separate thread as a leftover from other tests where I tried to avoid locking up the listener. I also tried an earlier test with a scheduled timer to kill the two processes, but that timer never got the chance to do anything. And I put the priorities of the two test threads to a low value in hopes that it would allow the listener to remain alive, but to no avail... so this shows that the BIG LOCK mechanism makes a mockery of the interrupt system and the priority system. Priority inversion is a very real danger here.
At any rate, after the code completes -- whichever thread completes its finite count kills the other -- an examination of the respective counts shows that only one of them incremented. Hence, another illustration of the effects of BIG LOCK on preventing sibling threads from ever running.
True enough, I probably didn't cause any page misses -- one can't be sure about this -- but I still don't see the relevance of that issue here. However, I'm eagerly awaiting elucidation on this point, as it sets off red flags and loud alarms in my mind...
(defparameter count1 0)
(defparameter count2 0)
(defparameter p1 nil)
(defparameter p2 nil)
(defun doit1 ()
(loop for ct from 0 to 100000 do
(incf count1)
(loop for ix from 1 to 10000 do
;; do something... Loop doesn't like null bodies
(if (= ix count1)
t
nil)
))
(if p2
(mp:process-kill p2)))
(defun doit2 ()
(loop for ct from 0 to 100000 do
(incf count2)
(loop for ix from 1 to 10000 do
;; do something... Loop doesn't like null bodies
(if (= ix count2)
t
nil)
))
(if p1
(mp:process-kill p1)))
#|
(mp:process-run-function "Launcher" ()
(lambda ()
(setf count1 0
count2 0
p1 nil
p2 nil)
(setf p1 (mp:process-run-function "Doit-1" '(:priority -1000) 'doit1))
(setf p2 (mp:process-run-function "Doit-2" '(:priority -1000) 'doit2))
))
|#
David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ 85750
email: dbm@refined-audiometrics.com
phone: 1.520.390.3995