[M3devel] select vs. poll?

Jay K jay.krell at cornell.edu
Sat Apr 17 10:31:05 CEST 2010


It looks to me like poll is usually preferred over select?

It appears to be standard and widely available.

  Appears to be *BSD, Solaris, Linux, Interix, AIX, Irix.

   At least searching the web and checking headers.

It has no limit on the number or value of file descriptors waited on.

It does use more memory for its parameters and more time to construct and read them.

However I believe we only ever select/poll either

  one file at a time on pthreads 

  one file per thread on user threads 

 

 

There are other better mechanisms -- /dev/poll on Solaris, kqueue on FreeBSD and maybe others, epoll on Linux.

Though these are mostly (completely?) concerned with scaling to waiting on large number of file descriptors.

 

 

I think I'll change over to poll very soon.

 

 

I haven't yet figured out if select's read/write/except maps directly to poll's flags.

I'm guessing:

  select read => poll POLLIN or maybe POLLPRI also?

  select write =>  poll POLLOUT

  select except => POLLERR or maybe POLLHUP also?

 

I haven't yet found a description of "error conditions" with respect to select.

Still looking.

 

 - Jay

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100417/fc415fba/attachment-0001.html>


More information about the M3devel mailing list