[plt-scheme] Efficient asynchronous communication primitives [PATCH]

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 17 10:03:02 EDT 2008

At Sun, 16 Mar 2008 11:55:21 -0400 (EDT), Dimitris Vyzovitis wrote:
> Working with multi-threaded and distributed code relies heavily in
> asynchronouscommunication.
> mzscheme offers 3 main constructs: semaphores, channels, and
> async-channels.
> semaphores are the lowest level of primitives, while channels are the
> basicsynchronous communication primitive. async-channels are built on top of
> channels using an additional synchronizer thread.
> Unfortunately, they all suffer: semaphores are too low-level and require
> quite a bit of work to be usable for communication, channels are
> synchronous, and async-channels are intolerably slow.
> It doesn't have to be this way. The attached patch implements asynchronous
> thread mailboxes, with 2 main primitives (thread-send and thread-receive,
> similar to gambit's equinamed primitives) and 2 auxiliary primitives
> (thread-try-receive and thread-receive-evt).

I can merge this soon.

But is there a reason to have a thread-specific mailbox, as opposed to
a built-in asynch channels (which I imagine would have similar
performance to the build-in thread mailboxes)?


Posted on the users mailing list.