The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
.
google unix.com



IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
POLL function fails under AIX v5.3 TahirNazir AIX 0 02-13-2008 11:15 PM
select/poll and Signal Safety nopcoder High Level Programming 0 01-27-2006 11:35 AM
Replace select/poll with kqueue/kevent bsderss UNIX for Dummies Questions & Answers 1 08-10-2005 01:14 PM
Quick Poll: Solaris IP Multipathing kduffin IP Networking 3 12-05-2003 12:16 PM
How to convert the "select" function into a "poll" function rbolante High Level Programming 1 07-10-2001 10:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-26-2007
smanu smanu is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 21
select vs poll

Hi,

Off late I had been looking at the differences b/w select() & poll() system calls. The requirement is to reduce the overhead, processor power in waiting for the data. In the kind of connections under consideration there would be very frequent data arriving on the sockets, so poll() fares well.

But!!! Even in the few millisec when the data is not arriving, the application can do something better! So will select() be a better function to go for?

In that case will there be any performance improvement at all?

Instead, is there a scope for some kind of asynchronous call back functions where the appliction will just be initimated in case data arrives.

On the whole, the requirement is that unnecessary waiting time should be cut & perfromance improved!

If this is not the right forum, can somebody suggest the right one.

Thanks in advance!!!
  #2 (permalink)  
Old 04-26-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
In many cases the choice is made for you.

If the system is BSD derived, then use select. In this case poll is merely a wrapper around select.

If the system is System V derived, then use poll. In this case select is merely a wrapper around poll.

The main advantage of poll is the number of file descriptors is not limited by the size of fd_set, other than that there is no real difference.

Just because you can specify the time in microseconds or nanoseconds does not mean the OS will honour those, they are still limited by the system/heartbeat clock frequency.

Last edited by porter; 04-27-2007 at 04:57 AM..
  #3 (permalink)  
Old 04-26-2007
srinivasan_85 srinivasan_85 is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 28
Completion Ports

Hi,
I dont know which platform your are working on. But of the query,
Quote:
Originally Posted by smanu
is there a scope for some kind of asynchronous call back functions where the appliction will just be initimated in case data arrives.
I guess for solaris 10 (Sun OS 5.10), there is a new amenity called "Completion Ports". I wonder if this may be useful for you. I dont have much background on this feature. But on quick glance at it, I guess it is a type of asynchronous request handler.

Excuse me if the information is misleading/away from the topic...

Thanks
Srini
  #4 (permalink)  
Old 04-27-2007
smanu smanu is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 21
Hi,

Srinivasan: Thanks for the information. That was exactly something I was looking out for. Do you by any chance have any idea about how much performance improvement can be achieved by replacing poll with Asynchronous I/O framework.

Porter: How do I check if my system is BSD derived or V derived?

/smanu.
  #5 (permalink)  
Old 04-28-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by smanu
Porter: How do I check if my system is BSD derived or V derived?
There are a number of ways but here we are trying to find out if select or poll is the more fundamental call. A suggestion is to look at sys/syscall.h and see if SYS_select or SYS_poll exist. If both exist then *maybe* both are native, but for instance not in the case of Darwin. In that case you could check to see which is the "earlier" call, ie if SYS_select is less than SYS_poll.
  #6 (permalink)  
Old 04-28-2007
smanu smanu is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 21
Ok! My syscall.h has got SYS_poll only.
So poll() seems to be the primitive one.

But could you tell me what are those other number of ways in which we can check if our system is BSD derived or V derived?
  #7 (permalink)  
Old 04-28-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by smanu
But could you tell me what are those other number of ways in which we can check if our system is BSD derived or V derived?
Off the top of my head the three main differences for a programmer are:

1. STREAMS

if has #include <sys/stream.h> it's SYS V

2. signals

if it has sigblock & sigsetmask it's BSD, if sighold & sigrelse it's SYS V

3. terminal handling

check prototype for "setpgrp()", if takes two args it's BSD


But as systems have all adopted BSD sockets and merging to standardisation on posix compatibility it is more important to check the actual feature you are trying to use.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0