Re: BSD sockets ::select() performance on 10.4.9
Re: BSD sockets ::select() performance on 10.4.9
- Subject: Re: BSD sockets ::select() performance on 10.4.9
- From: Terry Simons <email@hidden>
- Date: Tue, 10 Apr 2007 16:34:34 -0600
On Apr 10, 2007, at 3:27 PM, Steve Checkoway wrote:
On Apr 10, 2007, at 11:22 AM, Terry Simons wrote:
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.
In my case I was never writing to the descriptors... so it was
returning 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.
Right. ;)
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.
But if your application is getting bombarded with data, select will
return often and could possibly cause the CPU to grind, right?
- Terry
_______________________________________________
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