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: Steve Checkoway <email@hidden>
- Date: Tue, 10 Apr 2007 14:27:39 -0700
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.
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.
--
Steve Checkoway
_______________________________________________
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