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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4E002BBA7 for ; Tue, 7 Feb 2006 23:03:34 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k17M3Xov011942 for ; Tue, 7 Feb 2006 23:03:33 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA26859 for ; Tue, 7 Feb 2006 23:03:33 +0100 (MET) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k17M3WqN011795 for ; Tue, 7 Feb 2006 23:03:32 +0100 Received: by zproxy.gmail.com with SMTP id m7so1669302nzf for ; Tue, 07 Feb 2006 14:03:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EeJyPjBWI+S9z0GnLTD4Kq29L/OXOJZ5B1Ohdqo2xgEnTfOE5LZXArQ0KDaAh0INWyKKM+XqcM4HU0PXw2Z+JigPtRu9ALglBQh1DhVHIShqZ5vHeKjtjbh3ABWIRmDsa6cIrwcL1GZR0zgO0vZvi2Llwm04sKIM9gMjRYWSElg= Received: by 10.64.250.17 with SMTP id x17mr715206qbh; Tue, 07 Feb 2006 14:03:31 -0800 (PST) Received: by 10.64.10.15 with HTTP; Tue, 7 Feb 2006 14:03:31 -0800 (PST) Message-ID: Date: Wed, 8 Feb 2006 11:03:31 +1300 From: Jonathan Roewen To: rick@eltopia.com Subject: Re: [Caml-list] Re: async networking Cc: caml-list@inria.fr In-Reply-To: <1139347775.10092.6.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1139129530.15565.3.camel@localhost.localdomain> <1139160736.10812.3.camel@localhost.localdomain> <1139288125.19213.36.camel@rosella> <1139347775.10092.6.camel@localhost.localdomain> X-Miltered: at concorde with ID 43E91935.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43E91934.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 rewrite:01 thread:02 thread:02 linear:02 callback:02 callback:02 problem:05 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=RCVD_BY_IP autolearn=disabled version=3.0.3 > 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. Jonathan