[gambit-list] Multi-process

Christian Jaeger christian at pflanze.mine.nu
Sun Oct 5 20:24:45 EDT 2008


Guillaume Cartier wrote:
> I was having a discusion with someone about Gambit and he asked me the
> following question :
>
>
>   
>>  One issue...from the Gambit threading documentation.
>>
>> "Gambit supports the execution of multiple Scheme threads. These
>> threads are managed entirely by Gambit's runtime and are not related
>> to the host operating system's threads. Gambit's runtime does not
>> currently take advantage of multiprocessors (i.e. at most one thread
>> is running)."
>>
>> I really do need multiprocessor support as computer graphics gets a
>> pretty linear speedup on multiple CPUs. Do know if Gambit can, like
>> Lispworks, at least have calls into foreign functions running on
>> multiple CPUs?
>>
>>     
>
> Does Gambit support that model like Lispworks?

(I haven't used Lispworks.)

Currently there is no builtin support. But you can always run foreign 
code in separate system threads and communicate with them through pipes, 
and using macros you could even write a layer atop the builtin FFI to 
hide the communication handling. I've written cj-posix.scm which is a 
collection of interfaces to posix procedures and fd->port conversion, 
anyone interested please ask me for the current version.

In measurements I did some time ago, the cost of a roundtrip through 
pipes on Linux 2.6 between pthreads of the same process was about 4500 
cpu cycles (iirc that was on a Core2 duo in 64bit mode; it was only 
using read & write, not select inbetween though).

Christian.




More information about the Gambit-list mailing list