Sponsored Content
Full Discussion: select vs poll
Special Forums IP Networking select vs poll Post 302115724 by smanu on Thursday 26th of April 2007 07:04:32 PM
Old 04-26-2007
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!!!
 

7 More Discussions You Might Find Interesting

1. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies

2. UNIX for Dummies Questions & Answers

Replace select/poll with kqueue/kevent

Hi, As far as I known, kqueue/kevent model can be used to improve the efficiency of systems event dispatching. I m wondering whether kqueue/kevent is same as the real-time OS event model. I also want to know when writing multiplexing app in real-time OS, what APIs need to be used for... (1 Reply)
Discussion started by: bsderss
1 Replies

3. Programming

select/poll and Signal Safety

Hi I am struggling to understand why one should use pselect()/ppoll() instead of wrapping an ordinary select() or poll() call around sigprocmask(). The linux man page talks about “race conditions”, but how would such dangers occur? I plan to use poll() for an application (since ppoll() isn't... (0 Replies)
Discussion started by: nopcoder
0 Replies

4. UNIX for Dummies Questions & Answers

Poll data from a file

I have to write a script where I poll a txt file for data (30 min interval) Dependent on the data read, the script should return a message. It should look something like the "code" below: -- do while <data recived> sleep 30m read data from file Done If <data> x return "A" If... (1 Reply)
Discussion started by: ioniCoder
1 Replies

5. Shell Programming and Scripting

how to poll for new files?

Hi , i have a requirement in which i have to ftp files to unix from windows and vice versa. I have to encrypt files in windows which will then be decrypted in unix and vice versa. Now the process needs to be automated ..therefore when windows server or unix server recieves the files a shell... (5 Replies)
Discussion started by: lifzgud
5 Replies

6. Shell Programming and Scripting

How to use poll() for I/O multiplex

Hi, guys: I want to write my own shell using C. I am confused about the usage of I/O multiplex. Does anyone know some examples or explain it to me ? Thanks so much (1 Reply)
Discussion started by: tomlee
1 Replies

7. What is on Your Mind?

Powerhouses and mainstream poll

This not a joke but a quite serious question to maybe have your point of view about this very topic of content on the net. So I start this poll to ask the users if they can imagine that the so called content industry of former times sooner or later or anyway will regain lost ground or not? Do you... (1 Reply)
Discussion started by: 1in10
1 Replies
SELECT(9)						   BSD Kernel Developer's Manual						 SELECT(9)

NAME
seldestroy, selinit, selrecord, selnotify -- select and poll subsystem SYNOPSIS
#include <sys/param.h> #include <sys/select.h> void seldestroy(struct selinfo *sip); void selinit(struct selinfo *sip); void selrecord(struct lwp *selector, struct selinfo *sip); void selnotify(struct selinfo *sip, int events, long knhint); DESCRIPTION
selinit() and seldestroy() functions must be used to initialize and destroy the struct selinfo. The seldestroy() function may block. selrecord() and selnotify() are used by device drivers to coordinate with the kernel implementation of select(2) and poll(2). Each object that can be polled contains a selinfo record. Device drivers provide locking for the selinfo record. selrecord() records that the calling thread is interested in events related to a given object. selrecord() should only be called when the poll routine determines that the object is not ready for I/O: there are no events of interest pending. The check for pending I/O and call to selrecord() must be atomic. Atomicity can be provided by holding the object's lock across the test and call to selrecord(). For non-MPSAFE drivers, the global kernel_lock is enough to provide atomicity. selnotify() is called by the underlying object handling code in order to notify any waiting threads that an event of interest has occurred. The same lock held across the poll method and call to selrecord() must be held across the call to selnotify(). The lock prevents an event of interest being signalled while a thread is in the process of recording its interest. The events indicates which event happen. Zero may be used if unknown. selnotify() also calls KNOTE() passing knhint as an argument. CODE REFERENCES
The core of the select and poll subsystem implementation is in sys/kern/sys_select.c. Data structures and function prototypes are located in sys/sys/select.h, sys/sys/poll.h and sys/sys/selinfo.h. SEE ALSO
poll(2), select(2), knote(9) BSD
May 13, 2008 BSD
All times are GMT -4. The time now is 07:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy