gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Ideas on threads


From: Camm Maguire
Subject: [Gcl-devel] Ideas on threads
Date: 18 Oct 2005 21:45:32 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  Have been looking briefly at parallelism in let like
forms.  I had planned to put in a fork based plet which would read the
results from the child into the parent across a pipe.  I also need to
incorporate the great mpi work done by our mpi developer. (Will write
to you separately, Gene.) It got me thinking about threads and how we
might do this eventually.

My understanding is that most threading implementations give each
thread their own stack.  We'd have to make heavy use of this I'd
think.  The philosophy should perhaps be that correct code without
race conditions should work correctly, but that ill-defined situations
like

(let ((x 1))
        (let ((y (incf x)) (z (incf x))) (values y z)))

should not be protected, as there is no defined order and the user
should have used let*.

Given this philosophy, we have to ensure that gc, special bindings,
lexical bindings, and lisp stack operations work properly.  Taking
the last first, I think we would have to alloca a block at the
beginning of each thread and point vs_base and vs_top et. al. at it.
Compiled lexical bindings are already on the stack, and I believe
interpreted bindings are handled with the same mechanism as special
bindings.  Leaving us with the latter, which I can only conceive
working if we redefine the notion of symbol-value to indirect two
instead of one pointer.  I.e. add another slot to symbol which points
to the pointer to the binding under most circumstances.  Then when in
a thread, point to a location on the stack which points to the binding
-- this should automate the 'spaghetti-stack' concept.  Finally, put a
global lock around the gc, though the mark phase should be able to
proceed threaded.

Just ideas at this stage.  Comments and thoughts most welcome.

Take care,
-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]