Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
async networking
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-02-08 (04:18)
From: Rick Richardson <rick@e...>
Subject: Re: [Caml-list] Re: async networking
On Wed, 2006-02-08 at 11:03 +1300, Jonathan Roewen wrote:
> > The multiple serving threads could actually make for an simple api,
> > actually. A simple function to add a receive callback for a port would
> > be all you'd need. You could even pass in a buffer to that callback that
> > a person could respond directly to for socket send, since the same
> > thread is handling the send requests as well.
> I haven't checked the systhreads implementation (as I don't use it),
> but if it's anything similar to the vmthreads implementation, it is
> not very high performance.
> For example: to reschedule a thread, vmthreads a) uses select (not
> sure if this is a problem), and b) does a linear search for a runnable
> thread (I can't remember if it stops early, I'd have to have another
> check).
> The point is, in this case, you'd need to rewrite it to use thread
> queues for the various states to get something closer to an O(1)
> scheduler.
I technically don't need to officially reschedule.. since they will all
be doing the same thing, I'll sleep the thread, then when data becomes
available pass it the new fd and wake it up. A simple queue would be
fine for that. 

> Jonathan