[ssc-devel] Names of synchronization objects
Marco Monteiro
masm at acm.org
Sat Jul 29 17:18:11 UTC 2006
All synchronization objects have names. Names can be used to help
debugging: although there is still no way to get information on what a
thread is up to (like the PROCESS-WHOSTATE in some implementations) this
will probably be added in the future. The name mechanism is currently
used by some implementations. I now think that this is not the right way
to do it, for at least to reasons:
* (minor reason) a thread can be acquiring a lock, or waiting on a
condition variable, or passing a barrier, etc., in several different
places. With the name, this cannot be discerned: a thread can be
deadlocked in one of many different places.
* (major reason) imagine you build some abstractions over SSC, like
monitors, bounded-buffer, etc. These will be implemented with locks and
condition variables, etc. If a thread is blocked because a bounded
buffer is full, the 'whostate' of the process will be something like
"Blocked on lock 'buffers's lock'", instead of something more reasonable
like "Adding client to buffer".
So, what if we drop names from all synchronization objects and instead
add a &key argument to all function that can block? Basically, I'm
proposing taking the approach of PROCESS-WAIT of some implementations,
that accepts a whostate argument, and extend it to all functions that
can block.
We would then have code user like:
(with-lock (mutex :info "Mutual exclusion to list of clients")
(loop while (list-full-p list)
do (condvar-wait cv :info "List of clients is full"))
...)
and code built on a bounded-buffer implemented on SSC:
(put process-bbuffer client :info "Add client for process buffer")
Please comment.
Cheers,
Marco
More information about the Ssc-devel
mailing list