Re: POLL or SELECT

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Thu, 13 Feb 1997 14:32:22 +0200 (EET)

> From: Peter Marelas <maral@phase-one.com.au>
> To: squid-users@nlanr.net

> Im just wondering which I/O multiplexing function most people are using,
> and on what OS.
>
> The options being poll() or select()
> The default being select() unless USE_POLL is defined.
> Can anyone outline the pros and cons?
> We are running Squid 1.1.6 on Solaris 2.x.

    As of I know, Solaris actually in its libraries uses poll, so that
 when you do select(), library parses FD sets and does poll() to OS. If
 I am right, this involves allocating temporary array of pollfd structures,
 setting lots of request data upon call to OS and packing returned data
 back to FD_SET upon return. Quite an overhead. So, seems that using poll
 on Solaris would skip this overhead. But current implementation of
 USE_POLL seems to do that same overhead in squid process. Squid could be
 modified to eliminate this overhead totally, as poll isn't supposed to
 modify request part of pollfd structures and this array can be made
 static in squid.

    Other than that, USE_POLL is used to overcome a limit of 1024 file
 descriptors select() can handle on some OS-es. If you do not need more
 than 1024 open files at a time, i'd suggest to use select() for now.

-------------------------------------------------------------------
 Andres Kroonmaa Telefon: 6308 909
 Network administrator
 E-mail: andre@ml.ee Phone: (+372) 6308 909
 Organization: MicroLink Online
 EE0001, Estonia, Tallinn, Sakala 19 Fax: (+372) 6308 901
-------------------------------------------------------------------
Received on Thu Feb 13 1997 - 04:36:52 MST

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