changes to thread locking layer
Patrick Tullmann
tullmann at cs.utah.edu
Fri Mar 17 13:25:27 PST 2000
I've got a large (45K) patch to Kaffe's locking layers. This patch
cleans up the separation between the vm-internal locking and the
thread-specific layer locking. It makes the 'sem2posixLock' hack a
first class abstraction (a ksem). The threading interface's
requirements for locking are documented and, I think, quite a bit
simpler. (I sent out an updated FAQ describing these changes a couple
of weeks ago).
Since the patch is so large, I didn't include it in this message. You
can fetch it from:
http://www.cs.utah.edu/~tullmann/ksem-diff.txt,
Or, I can mail it to anyone who asks.
I tested these changes with the OSKit-pthreads port, the unix-jthreads
port, Utah's nodeos-thread port, and a little bit with the
unix-pthreads port. Since the unix-pthreads stuff didn't work for me
before (see my earlier mail from today), I can only report that the
patched version has the same problems. :)
The only real bug I fixed (if you don't count ugly code as a bug) is
that the heavy-weight lock attached to each thread wasn't being
destroyed when the thread was, in unix-pthreads, this meant leaking
mutexes and condvars. (In unix-jthreads it didn't matter.)
One downside to this patch is that the beos-native thread port and the
win32 thread ports get even farther out of date. Though, I belive
things should be much simpler for the beos port (as it has native
semaphore support).
Please let me know if there are any problems with the patch.
Here's a ChangeLog entry:
ChangeLog:
Patrick Tullmann <tullmann at cs.utah.edu>:
* FAQ/FAQ.locks: Updated to clearly define the ksem and jmutex
interfaces and the boundary between vm locking and threading
layer locking.
* kaffe/kaffevm/mem/gc-mem.c: include thread.h instead of
jthread.h.
* kaffe/kaffevm/ksem.h, kaffe/kaffevm/locks.c,
kaffe/kaffevm/locks.h, kaffe/kaffevm/Makefile.am: Added
ksem.h. Is a cleanup of the sem2posixLock defines and the
thread-dependent locking layer. Added comments, removed
lots of #if0 and other dead code. Use debug.h macros.
* kaffe/kaffevm/thread.c: Use the Ksem abstraction. Destroy
the per-thread heavy lock when thread is killed.
* kaffe/kaffevm/systems/oskit-pthreads/*: move the lock
interfaces into lock-impl.h, add jcondvar_destroy() and
jmutex_destroy() methods.
* kaffe/kaffevm/systems/unix-jthreads/*: remove unused
functions for gettings lists of threads on mutex/cvs.
Remove dead support code for those functions. Add
jmutex_destroy() and jcondvar_destroy(). Move lock
interfaces into lock-impl.h, out of jthread.h. Clean up
lock-impl.h to match new ksem interfaces.
* kaffe/kaffevm/systems/unix-pthreads/*: Use the jmutex_ and
jcondvar_ interfaces for locking, remove lots of macro
layers. Remove redundant per-native-thread lock
infrastructure. (Its is redundant with the per-thread
ksem managed in kaffevm/thread.c).
-Pat
----- ----- ---- --- --- -- - - - - -
Pat Tullmann tullmann at cs.utah.edu
Your research fills a much needed gap.
More information about the kaffe
mailing list