• 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: select() weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: select() weirdness


  • Subject: Re: select() weirdness
  • From: Steve Dekorte <email@hidden>
  • Date: Fri, 25 Feb 2005 13:56:09 -0800


On Feb 25, 2005, at 7:48 AM, Quinn wrote:
At 7:19 -0800 25/2/05, Steve Dekorte wrote:
I'm calling select() with a timeout of 0 and it usually returns immediately, but every few thousand calls, it will hang for a few seconds or more (up to about a 20 seconds!). The read and write fdset sizes are always 4.

Does anyone know what could be causing this?

select is implemented by the BSD subsystem. Concurrency control in the BSD subsystem (at least prior to Tiger) is controlled by two funnels (giant mutexen), one for networking and another for the rest of the kernel. It could be that your call to select is being held up behind another thread doing something expensive while holding one of the BSD funnels.


My guess is that you could debug this using Shark (run Shark's sampling profiler, then stop it programmatically when you notice a long latency select; failing that, the "chudKDebugTrace.h" looks mighty interesting), but I don't have time to research the details today.

Thanks for the response.

Here's the results of grabbing a sample while select() was hanging for several seconds in Shark:
http://www.dekorte.com/Library/select.jp2


Notes:

System: Darwin Kernel Version 7.8.0 Power Macintosh powerpc (dual 2.5Ghz G5)

Select is only being given sockets waiting to connect only. As soon as they connect, I write one line and then close the socket.

This is a single threaded application and I shut down all desktop apps (other than Terminal and Shark) for this test.

Any suggestions?

-- Steve

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


  • Follow-Ups:
    • Re: select() weirdness
      • From: Quinn <email@hidden>
References: 
 >select() weirdness (From: Steve Dekorte <email@hidden>)
 >Re: select() weirdness (From: Quinn <email@hidden>)

  • Prev by Date: Re: Multiple IOMedia objects creation in Filter Scheme Driver
  • Next by Date: Re: select() weirdness
  • Previous by thread: Re: select() weirdness
  • Next by thread: Re: select() weirdness
  • Index(es):
    • Date
    • Thread