[gambit-list] 0mq with Gambit

Feng Hou houfen at gmail.com
Sun Apr 10 22:56:55 EDT 2011


On Wed, Apr 6, 2011 at 9:13 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:

>
> On 2011-04-03, at 11:04 PM, Feng Hou wrote:
>
> > Hello everyone,
> >
> > Gambit has great concurrency support by green-thread and no-blocking I/O
> scheduling. However, they are only able to use one native thread on
> multicore hardware. I have noticed some wish list on wiki for
> multicore/multiprocessing concurrency support. I'm wondering whether 0MQ (
> http://www.zeromq.org/) can be used as substance for Gambit to build such
> capabilities.
> >
> > My thoughts are,
> >
> > -- Not just a FFI binding.
> > -- Use it as message passing broker for multicore and distributed
> concurrency.
> > -- Share nothing between the GVM thread and other in-process native
> threads (doing long CPU bound computation or blocking I/O).
> > -- How to integrate 0MQ inter-thread transport to gambit green-thread
> scheduler without blocking it?
> > -- Would it be possible to bind 0MQ inter-thread socket to gambit
> mailbox?
> > -- How to integrate 0MQ I/O event poller with gambit I/O loop?
> > -- Would it be better to expose 0MQ IPC/TCP/PGM socket types as Gambit
> Port objects?
> >
> > I realized they were way beyond my knowledge and skill level to implement
> (some may not even make sense, please correct me). Nevertheless, just want
> to see if others have similar thoughts or needs.
> >
> > Cheers,
> > Feng Hou
>
> I quickly read the 0MQ docs and it seems interesting.  I can give pointers
> to whoever wants to implement them into Gambit.
>
> Marc
>
>
Hello,

A few FFI questions,

1) What's the standard api for FFI on C side? C macros in gambit.h? Any
other files I should study?

2) Is this code safe in terms of GC?

(define zmq-send
  (c-lambda (socket* scheme-object int) int
#<<c-lambda-end

void *u8vectorptr = ___CAST(void*,___BODY(___arg2));
size_t size = ___U8VECTORLENGTH(___arg2);
___result = zmq_send (___arg1, u8vectorptr, size, ZMQ_DONTWAIT | ___arg3);

c-lambda-end
))

3) How can I allocate an u8vector of size n in C code (memcpy to its
content), then return it to scheme code?

4) Is it GC safe to attach a foreign pointer directly to u8vector body?

Sample code or existing reference are appreciated.

Cheers,
- Feng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110410/36eb0cbe/attachment.htm>


More information about the Gambit-list mailing list