Sockets and Multiple-connection servers

Stephen Pair spair at advantive.com
Tue Mar 12 02:52:32 UTC 2002


> > to a separate thread for handling as it continues to wait for new 
> > connections (similar to popular models in Java or MFC Sockets)? Is 
> > there a good reason not to use this model?
> 
> I also did this in the first version of my network library.
> 
> But, you may be better off not multithreading, but rather 
> scanning each socket. Multithreading is semi-expensive on 
> squeak.. Lightweight, but it may be faster to, for example, 
> have one thread scan all of the sockets than try to trust 
> multithreading like this.
> 
> Scott

Assuming that you're talking about Squeak processes (and not OS
threads), why do you believe that scanning sockets would be any faster
than the VM scanning through processes looking for the next one that's
ready to run?  I've had the best success (performance and design wise)
having one process accepting sockets and forking a new process to handle
each socket as it is accepted.  This is the way Comanche has always
worked.

- Stephen




More information about the Squeak-dev mailing list