* I/O event notification mechanism - select() or epoll() ?
@ 2012-09-26 11:49 Rahul Bedarkar
2012-09-26 15:49 ` Peter Teoh
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rahul Bedarkar @ 2012-09-26 11:49 UTC (permalink / raw)
To: kernelnewbies
Hi,
I have to capture kernel udev events through libudev. One of API
provides asynchronous events by reading on file descriptor. I found
that there two ways to do that.
1) select call
2) epoll
I also found that epoll is smarter and meant to replace old select call.
What are your thoughts on these ? Which one is better ?
Thanks
Rahul B.
^ permalink raw reply [flat|nested] 5+ messages in thread
* I/O event notification mechanism - select() or epoll() ?
2012-09-26 11:49 I/O event notification mechanism - select() or epoll() ? Rahul Bedarkar
@ 2012-09-26 15:49 ` Peter Teoh
2012-09-28 5:23 ` michi1 at michaelblizek.twilightparadox.com
2012-09-28 17:05 ` Jonathan Neuschäfer
2 siblings, 0 replies; 5+ messages in thread
From: Peter Teoh @ 2012-09-26 15:49 UTC (permalink / raw)
To: kernelnewbies
On Wed, Sep 26, 2012 at 7:49 PM, Rahul Bedarkar <rpal143@gmail.com> wrote:
> Hi,
>
> I have to capture kernel udev events through libudev. One of API
> provides asynchronous events by reading on file descriptor. I found
> that there two ways to do that.
>
> 1) select call
>
I guessed when u called select() it will block, and so u can be very
efficient - doing nothing until necessary, but also resource being used up
- as the process is solely dedicated to listenting for event only.
> 2) epoll
>
> good thing is u can parallel process other stuff at the same time, if
after polling the replies from udev is not back yet. but the bad thing is
response may not be so immediate, as u may be doing something else when the
udev event comes in.
> I also found that epoll is smarter and meant to replace old select call.
>
> What are your thoughts on these ? Which one is better ?
>
> Thanks
> Rahul B.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120926/874f7559/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* I/O event notification mechanism - select() or epoll() ?
2012-09-26 11:49 I/O event notification mechanism - select() or epoll() ? Rahul Bedarkar
2012-09-26 15:49 ` Peter Teoh
@ 2012-09-28 5:23 ` michi1 at michaelblizek.twilightparadox.com
2012-09-28 5:28 ` Rahul Bedarkar
2012-09-28 17:05 ` Jonathan Neuschäfer
2 siblings, 1 reply; 5+ messages in thread
From: michi1 at michaelblizek.twilightparadox.com @ 2012-09-28 5:23 UTC (permalink / raw)
To: kernelnewbies
Hi!
On 17:19 Wed 26 Sep , Rahul Bedarkar wrote:
> Hi,
>
> I have to capture kernel udev events through libudev. One of API
> provides asynchronous events by reading on file descriptor. I found
> that there two ways to do that.
>
> 1) select call
> 2) epoll
>
> I also found that epoll is smarter and meant to replace old select call.
>
> What are your thoughts on these ? Which one is better ?
If you are ok to be limited to linux, I would highly recommend using epoll
because of scaleability. Using select is almost like creating a new epoll
descriptor for every call instead of reusing it.
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* I/O event notification mechanism - select() or epoll() ?
2012-09-28 5:23 ` michi1 at michaelblizek.twilightparadox.com
@ 2012-09-28 5:28 ` Rahul Bedarkar
0 siblings, 0 replies; 5+ messages in thread
From: Rahul Bedarkar @ 2012-09-28 5:28 UTC (permalink / raw)
To: kernelnewbies
Thanks Michi and Peter !
On Fri, Sep 28, 2012 at 10:53 AM,
<michi1@michaelblizek.twilightparadox.com> wrote:
> Hi!
>
> On 17:19 Wed 26 Sep , Rahul Bedarkar wrote:
>> Hi,
>>
>> I have to capture kernel udev events through libudev. One of API
>> provides asynchronous events by reading on file descriptor. I found
>> that there two ways to do that.
>>
>> 1) select call
>> 2) epoll
>>
>> I also found that epoll is smarter and meant to replace old select call.
>>
>> What are your thoughts on these ? Which one is better ?
>
> If you are ok to be limited to linux, I would highly recommend using epoll
> because of scaleability. Using select is almost like creating a new epoll
> descriptor for every call instead of reusing it.
>
> -Michi
> --
> programing a layer 3+4 network protocol for mesh networks
> see http://michaelblizek.twilightparadox.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* I/O event notification mechanism - select() or epoll() ?
2012-09-26 11:49 I/O event notification mechanism - select() or epoll() ? Rahul Bedarkar
2012-09-26 15:49 ` Peter Teoh
2012-09-28 5:23 ` michi1 at michaelblizek.twilightparadox.com
@ 2012-09-28 17:05 ` Jonathan Neuschäfer
2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Neuschäfer @ 2012-09-28 17:05 UTC (permalink / raw)
To: kernelnewbies
On Wed, Sep 26, 2012 at 05:19:50PM +0530, Rahul Bedarkar wrote:
> Hi,
>
> I have to capture kernel udev events through libudev. One of API
> provides asynchronous events by reading on file descriptor. I found
> that there two ways to do that.
>
> 1) select call
> 2) epoll
>
> I also found that epoll is smarter and meant to replace old select call.
>
> What are your thoughts on these ? Which one is better ?
I personally prefer event loop libraries such as libev[1]. They handle
all the interfacing with the event mechanism the OS provides, so you
only need to register a callback function.
HTH,
Jonathan Neusch?fer
[1] http://software.schmorp.de/pkg/libev.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-28 17:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 11:49 I/O event notification mechanism - select() or epoll() ? Rahul Bedarkar
2012-09-26 15:49 ` Peter Teoh
2012-09-28 5:23 ` michi1 at michaelblizek.twilightparadox.com
2012-09-28 5:28 ` Rahul Bedarkar
2012-09-28 17:05 ` Jonathan Neuschäfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).