[plt-scheme] Re: IPC in PLT Scheme

From: patrickdlogan at attbi.com (patrickdlogan at attbi.com)
Date: Thu Jan 30 13:05:24 EST 2003

> I am working on a project which requires some communication between
> two processes both of which I was hoping could be coded in
> Scheme. This communication follows a producer/consumer pattern.

> I would like for the producer to be able to operate even when a
> consumer is not running (presumably by queing output which would be
> retrieved later by the consumer).

> Do you guys have any suggestions on how to achieve this?

What I have done, successfully, in the past is to implement a simple
kind of "tuple space". They are easy to implement, perform well
enough, and provide plenty of flexibility as your requirements change:
message types, communication patterns, number of participants,
location, etc.

If your processes might run on multiple machines, then you can use
XML-RPC.

Implement a tuple space server that has three basic commands:

"give" - give a tuple to the space.

"take" - take any one tuple from the space that matches a given
         pattern. Timeout if none match.

"scan" - copy all tuples from the space that match a given pattern.

Your patterns may be "match anything" if you just want to exchange all
messages. For large MB messages you may want to store a file name as
the message and read the file out-of-band, or some other out-of-band
approach.

-Patrick


Posted on the users mailing list.