From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 7C3B8BBA7 for ; Wed, 8 Feb 2006 05:18:07 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k184I71s009829 for ; Wed, 8 Feb 2006 05:18:07 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id FAA32007 for ; Wed, 8 Feb 2006 05:18:06 +0100 (MET) Received: from mailscan1.sslisp.com (lb.sslisp.com [209.213.12.74]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k184I5fG014522 for ; Wed, 8 Feb 2006 05:18:05 +0100 Received: from [192.168.0.99] (68-186-66-70.dhcp.knwk.wa.charter.com [68.186.66.70]) by mailscan1.sslisp.com (Vircom SMTPRS 4.2.425.16) with ESMTP id for ; Tue, 7 Feb 2006 20:17:57 -0800 X-Modus-ReverseDNS: OK X-Modus-BlackList: 68.186.66.70=OK;rick@eltopia.com=OK X-Modus-RBL: 68.186.66.70=OK X-Modus-Trusted: 68.186.66.70=NO Subject: Re: [Caml-list] Re: async networking From: Rick Richardson Reply-To: rick@eltopia.com To: caml-list@inria.fr In-Reply-To: References: <1139129530.15565.3.camel@localhost.localdomain> <1139160736.10812.3.camel@localhost.localdomain> <1139288125.19213.36.camel@rosella> <1139347775.10092.6.camel@localhost.localdomain> Content-Type: text/plain Organization: Eltopia Date: Tue, 07 Feb 2006 20:18:01 -0800 Message-Id: <1139372282.10092.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 43E970FF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43E970FD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 async:01 threads:01 api:01 buffer:01 systhreads:01 scheduler:01 reschedule:98 reschedule:98 wrote:01 rewrite:01 thread:02 thread:02 data:02 linear:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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