• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: kevent and wait time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kevent and wait time?


  • Subject: Re: kevent and wait time?
  • From: email@hidden
  • Date: Sun, 9 Apr 2006 15:36:24 -0700


Dave,

kqueue is not select/poll.

To better understand what I mean by that, consider calling kevent() once per FD you allocate and only use kevent() to add to the kqueue.

I'm using the EV_SET macro to add to the queue, but my understanding is that it's calling kevent() to do it.


Then, as a part of your event loop, only fetch one event with kevent () and process it.

This is exactly what i'm doing ... but I don't see how specifying a timespec with 0 makes kevent() return an event for some FD i've never heard of. If I specify NULL, or a timespec with non-0 (tv_sec = 1, for instance), then it works. I just want to understand the API, is all.


Also, I expanded my kqueue test to use sockets as well as files, and i'm seeing a couple of interesting things: a.) when it works, my dinky little 1.5ghz 12" PowerBook G4 can process hundreds of thousands of events per second (socket reads is what i'm testing right now), but b.) it seems kinda iffy e.g. if I set ulimit -n to 10010 and run my test with 10000 FDs (sockets), it will almost always make my PowerBook bring up the spinning beach ball for everything, and I can't ctrl-C in terminal windows anymore, can't check mail, can't select any menu item, can't ping it from another machine, etc. After I force restart (by holding down the power button), if I set ulimit -n to 5010 and try my test with 5000 FDs (sockets), it will sometimes work (and give me really good numbers), but sometimes bring up the spinning beachball for everything like 10000 did. This is running OSX 10.4.6, using Apple's gcc4.0.0, with 1.25MB RAM. On my dual 2ghz G5 (still running 10.3.9 for other reasons), it acts much worse -- it locks the whole thing up, and the fans get louder and louder and louder until I force restart it.

It very well may be that i'm doing something wrong, but other stuff i've read about kqueues say how much better they are at doing select ()-y type things for large numbers of descriptors e.g. for building very scaleable server applications that can handle thousands / tens of thousands of simultaneous active connections. Like I said, i'm just trying to understand the API.

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com











_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: kevent and wait time?
      • From: Dave Zarzycki <email@hidden>
References: 
 >kevent and wait time? (From: email@hidden)
 >Re: kevent and wait time? (From: Dave Zarzycki <email@hidden>)

  • Prev by Date: Re: waitid() function replacement
  • Next by Date: Re: kevent and wait time?
  • Previous by thread: Re: kevent and wait time?
  • Next by thread: Re: kevent and wait time?
  • Index(es):
    • Date
    • Thread