Re: OPTIMISTIC_IO

From: Duane Wessels <wessels@dont-contact.us>
Date: Mon, 28 Dec 1998 11:40:45 -0700

Alex Rousskov writes:

>On Sun, 27 Dec 1998, Carlos Maltzahn wrote:
>
>> I noticed the OPTIMISTIC_IO directive - what is the purpose of it? It
>> seems to cause less trips through the select loop...
>
>Right. Select()-ing on a file is a NoOp on many (most?) Unixes. In many
>environments, selecting for write on a socket usually returns "ready". Thus,
>it may be tempting to avoid select() whatsoever for files and "write"
>sockets.
>
>The essential code change is simple, and most of the #ifdef-ed lines you see
>are there to check for "calling_io_handler" loops and such. With no select()
>pause between operations, nasty things may happen if you are not careful.

There are some hidden problems in the current code which do not
appear because every HTTP request goes through at least one
time through the select loop.

With OPTIMISTIC_IO enabled, some times you could do all of:

        accept
        read
        write
        close

within a single IO handler invocation. The close free's some state
data structure, and we assume that its still valid afterwards. Or,
in other words, we assume that a client HTTP socket is never closed
during the time we are in clientReadRequest().

Duane W.
Received on Tue Jul 29 2003 - 13:15:55 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:02 MST