Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlnet and kernel poll
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: ocamlnet and kernel poll
On 11-09-2008, Joel Reymont <joelr1@gmail.com> wrote:
>
> On Sep 11, 2008, at 4:32 PM, Markus Mottl wrote:
>
>> Use bigstrings as buffers and
>> perform I/O outside of the OCaml-lock if releasing it (depends on
>> I/O-size) is more efficient.
>
> Are you suggesting using multiple OS threads within a single process?
>
> When exactly do you release the lock and how do you perform IO outside  
> of it?
>
> How do you determine whether to release the lock or not?
>

I tink Markus is talking about the lock of the OCaml GC. When you do a
potentially long syscall (like select, read...) the GC lock is released
letting other OCaml thread running. 

Look at enter_blocking_section()/leave_blocking_section() in C part of
OCaml source.

You will still have 1 OCaml thread running but many other thread in C
call can also be running.

In particular, it means that OCaml thread can be used for standard
"non-blocking" syscall replacement.

Regards,
Sylvain Le Gall