[Openmcl-devel] new 0.14 alpha binaries
Sven Van Caekenberghe
sven at beta9.be
Wed Mar 19 05:04:27 PST 2003
If you have learned to deal with multithreading in Java, as I did,
something like with-lock-grabbed is much closer to synchronized blocks
and methods (and easier to understand) than without-interrupts.
Furthermore, I think it is more efficient in most cases, since threads
that are not trying to access the same lock-protected resources can
keep on running independently.
On Wednesday, March 19, 2003, at 01:58 AM, Gary Byers wrote:
> Anyway, there's reason to believe that the paserve code that I uploaded
> will fail under some conditions (and the reason(s) is/are instructive.)
>
> One of those reasons is that critical sections of code (that require
> exclusive access to data structures) are protected by:
>
> (without-interrupts
> (do-things-requiring-exclusive-access))
>
> In cooperatively-scheduled lisps, that's a common idiom (since WITHOUT-
> INTERRUPTS had the side-effect of preventing the lisp scheduler from
> running); it was a kind of shorthand for:
>
> (with-appropriate-locking
> (do-things-requiring-exclusive-access))
>
> and WITHOUT-INTERRUPTS was generally assumed to be cheaper.
>
> Since there's no lisp scheduler anymore, WITHOUT-INTERRUPTS doesn't
> prevent other threads from running; if there were such a thing as
> WITH-OTHER-THREADS-SUSPENDED (I'm not saying ...), it would be a very
> expensive, potentially dangerous thing whose casual use should be
> discouraged.
>
> To really be confident that we have exclusive access to shared
> data structures, we need to use appropriate locking primitives.
> Appropriate locking primitives generally exist in cooperatively
> scheduled lisps as well (WITH-LOCK-HELD).
>
> FWIW, OpenMCL 0.14 still contains cases where WITHOUT-INTERRUPTS is
> (mis-)used this way. WITHOUT-INTERRUPTS still exists and has its
> uses, but a lot of the cases where it's still used in OpenMCL (and in
> paserve) should be replaced with something more appropriate.
--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc
_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list