Re: Threading/timer issues on Mach-O vs. OS 9
Re: Threading/timer issues on Mach-O vs. OS 9
- Subject: Re: Threading/timer issues on Mach-O vs. OS 9
- From: philippe wicker <email@hidden>
- Date: Mon, 24 Apr 2006 15:30:11 +0200
On Apr 24, 2006, at 7:24 AM, Kurt Revis wrote:
Also -- and I know this is beyond the bounds of what you want to do
right now -- I really recommend that you think about a redesign in
the future. There's a considerable amount of overhead in making
your thread wake up 1000 times a second, and it's especially
pointless if you do nothing 99.9% of the time. It's entirely
possible to get rid of all this overhead, and wake up your timer
thread only when it has actual work to do.
I totally agree with your recommendation. However, the overhead of
waking up a thread every 1 ms is not so overkill as it may seem at
first glance. I've made a little bench where a thread waiting on a
POSIX condition (pthread_cond_wait) is woken up by a second thread
(using pthread_cond_signal). Both threads are max priority "standard"
threads (ie not time constrained threads). On a dual core dual
processor 2.7GHz PowerMac the average wake up time is around 26
microsec with a peak at 62 microsec . If I launch iTunes or Logic Pro
7 while the bench is running, the average is unchanged and the peak
reaches around 80 microsec.
The accuracy of the wait time is also good. Running the same kind of
bench I measure an average sleep time of 1010 microsec for a
theoretical required value of 1000 microsec. The longest sleep time
is around 1060 microsec even when a "time sharing" thread is running
full time on the background. I got a 1180 microsec once when
launching iTunes.
I didn't try with "time constrained threads" but I guess the results
should be better.
--
Kurt Revis
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden