How to kill a SocketServer?

Andrew MacIntyre andymac at bullseye.apana.org.au
Tue Apr 13 10:38:04 EDT 2004


On Tue, 13 Apr 2004, Peter Hansen wrote:

> The OP indicated that "esp. the reaction time" was his concern, not
> throughput.  If he's right about that, then in principal he could well
> be right that an async server would not be the most appropriate.
> (I don't really believe that either, though...)

If you consider OS architecture, I'm aware of 2 basic streams of think
about process management:
- clone the existing process;
- start each new process from a clean slate.

The first approach includes Unix and the second includes MS-DOS &
derivatives (eg Windows & OS/2).

OSes built around the first appoach have been highly optimised in ways
that favour resource sharing by multiple processes, such as file handle
& socket inheritance.  This architecture tends to favour the async
process model, as the resource overhead per process is modest.

The second approach usually has a much higher cost when resource sharing
(like file handle & socket inheritance) is taken into account, as the
resource sharing has to be implemented after the new process has been
instantiated rather than as part of the instantiation.  As such, this
architecture tends to favour the threaded approach, as the resources are
much more easily shared.

I don't know what Cygwin's fork() performance is like, or what limitations
it might have, but I am familiar with the EMX fork() implementation on
32bit OS/2.  EMX's fork() is quite resource intensive, due to having to
synthesize a lot of machinery that is part of the infrastructure of Unix.
Yes, you can spawn() (which is relatively cheap), but then the
resources have to be explicitly managed at the application level with
associated costs.

By contrast, OS/2 is an environment highly developed for threads.
Similarly with Win32 in my understanding.

So it seems to me that the prevailing view that async is more effective
needs to be tempered with a view of resource costing.  IMHO, threaded
models have been adopted by software such as Apache and Firebird (nee
Interbase) for at least certain platforms and problem domains for
pragmatic reasons at least as much as political reasons.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia




More information about the Python-list mailing list