On Tue, Sep 28, 1999 at 10:06:11AM -0500, Avi Saxena wrote:
> Thanks for the response. I have recently started looking in the squid code.
>
> In main.c, we have a comm_poll that polls for icp and http requests
> comm_poll_icp_incoming and comm_poll_http_incoming. It is doing this in a
> loop and sequentially. We check for the requests on the fd's and if there is
> one, we call the handler for that (sequentially). We do not call 2 handlers
> at one time, i.e. * if one handler takes a long time other requests are
> blocked for that time. * Is this correct? or am I missing soething. I am
> using Linux. When should "HAVE_POLL" be undefined? What are the pros and
> cons?
I haven't looked at the code, but I've written this type of application
in the past and know the theory. Here's how to read the code: when the
"poll()" or "select()" operation - depending on exactly what OS
interface you're using - indicates a request on an FD, that should mean
it can be serviced more or less instantly when that FD is accessed.
E.g. on a disk file read, the poll response means there is a block
already fetched off the disk and waiting in memory for you to accept
it; on a network connection write, the buffer is empty and you can
chuck data into it and return; etc.
This is all happening within the context of a single process, so it
avoids a lot of expensive context switching (and even more expensive
forking/execing of a varying number of processes) and enables much
higher performance even on relatively low-end CPUs. When your
operating system does *not* have this kind of facility - to know in
advance that an I/O request is already ready and will return
immediately - then you've got problems, and you can't really use this
model.
-- Clifton, used to do embedded systems programming
-- Clifton Royston -- LavaNet Systems Architect -- cliftonr@lava.net "An absolute monarch would be absolutely wise and good. But no man is strong enough to have no interest. Therefore the best king would be Pure Chance. It is Pure Chance that rules the Universe; therefore, and only therefore, life is good." - ACReceived on Tue Sep 28 1999 - 16:52:15 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:48:34 MST