Re: BSD sockets ::select() performance on 10.4.9
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Apr 10, 2007, at 11:22 AM, Terry Simons wrote: -- Steve Checkoway _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Are you using exception/write fd sets, or just the read sets? In one of my applications I initially had write sets turned on, and saw a CPU spike, presumably because select was returning immediately due to at least one of the descriptors being writable (which is almost always the case). When select returns, you need to read data from each descriptor in the read set and write data to each descriptor in the write set otherwise select will return immediately. My application doesn't have a lot of data, though, so removing the write sets was enough to settle things down. If you aren't planning on writing, the descriptors should not be added to the set. You could impose some sort of artificial sleep condition every now and then to force your application to yield the CPU, but that could cause performance issues too. As long as there is no data to read and you are not writing, select should block without needing any sleep. This email sent to site_archiver@lists.apple.com
participants (1)
-
Steve Checkoway