Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Optimizing thread performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimizing thread performance



On Sep 11, 2006, at 9:42 AM, Jeremy Sagan wrote:

I am trying to optimize thread performance and it almost works perfectly. What I am trying to do is to signal a high-priority secondary thread to wakeup and execute as soon as possible when certain criteria is met on a core-audio thread. I am using semaphore_signal to signal to the secondary thread. I also am having the secondary thread sleep only for the appropriate number of nanoseconds with semaphore_timedwait in an attempt to have just wake-up on time. The problem I am running into is that the secondary thread will sleep sometimes for more than 30 milliseconds even after being signaled by the semaphore mechanism.

Is there a way to tell the scheduler to immediately place the secondary thread at the front of the queue?

I have tried setting real-time priority with THREAD_TIME_CONSTRAINT_POLICY but it does not seem to make any difference. In fact it actually works better if I simply set a high priority using THREAD_PRECEDENCE_POLICY.

kern_return_t semaphore_signal_thread(sempahore_t sem, thread_t thread);

--
Shaun Wexler
MacFOH
http://www.macfoh.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. PerfOptimization-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Optimizing thread performance (From: Jeremy Sagan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.