Re: ANN: Etiquette: a protocol construction tool

"Thomas F. Burdick" <[email protected]> Wed, 17 Sep 2003 22:25:22 -0700
Newsgroups gmane.lisp.clump
Message-ID <[email protected]>
Peter Seibel writes:
 > Luke Gorrie <[email protected]> writes:
 > 
 > > A variation is to have a thread pool of a fixed maximum size, but
 > > this is not very robust. It assumes you will never have to block on
 > > more than N connections at a time, which breaks down with
 > > slow/unreliable clients and with DoS attackers.
 > 
 > Another variant (which worked quite successfully in a message
 > processing system I worked on in Java) is to use a fixed number of
 > threads to provide an asynchronous interface to things that are
 > fundamentally blocking. Thus you have one thread devoted to running
 > your state machines (or possibly N threads, where N is the number of
 > CPU's in your machine) and then you use one thread to deal with each
 > place you have to blocking i/o.

I think this is on the right track.  The problem with C-style structs
is that they're too lightweight to capture a state-machine easily.
Continuations are too general, though -- the state machine doesn't
consist of all possible state, just the stat it consists.  After
learning SmallTalk, I wrote a Lisp server using ST-style message
passing for network I/O.  Personally, I found message-passing to be a
wonderful interface to nonblocking I/O.  When writing the code, I
didn't feel like I was making async-io code; it just felt like nice OO
code; the heavyweight object (plus all its associated closures)
captured the state machine pretty easily.  Sure, there were a few
times where I wished I could close over a CATCH tag -- but I was able
to work around them without too much trouble.

Unfortunately, I haven't had the chance to develop that strategy to a
larger scale to see if it really is (for me, at least) the abstraction
sweet spot we're all looking for.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'