Re: Audio threads scheduling
Re: Audio threads scheduling
- Subject: Re: Audio threads scheduling
- From: Jeff Moore <email@hidden>
- Date: Wed, 31 Mar 2004 12:14:03 -0800
One last thing, I should caution that the parameters the HAL uses for
scheduling it's IO threads can and will change in the future as the
system evolves and we learn more about it. In other words, I wouldn't
write code that depends on this stuff working this way.
On Mar 31, 2004, at 12:10 PM, Jeff Moore wrote:
The computation value indicates the initial period for which the
thread will not be pre-emptible. I believe that this is implemented in
scheduler by when it sets the decrementer interrupt to next go off.
The HAL chooses the value for this parameter so that shorter IO cycles
get more time to not be pre-emptible and longer cycles become
pre-emptible sooner. This, in effect, prioritizes the shorter cycle
over the longer cycle.
This prevents a priority inversion that can occur when there are
cycles with both large and small durations in which the IOProcs are
using reasonable CPU loads. For instance if both Process A and Process
B are using 25% CPU load in their respective IOProcs, but A's cycle is
4000 frames long and B's cycle is 100 frames long. If A's cycle didn't
become pre-emptible quickly enough, it would easily cause B to miss
many of it's cycles, even though both processes are using reasonable
CPU loads.
It also encourages IOProcs to execute faster so the thread can go back
to sleep as this is less likely to get pre-empted.
On Mar 31, 2004, at 1:10 AM, Stiphane Letz wrote:
Hi,
I've made some test to undersand the audio thread scheduling
parameters. Here are the value I get using the "thread_policy_get"
function to retrieve the scheduling parameters for various buffer
size :
Frames : period : computation : constraint : preemptible
32 725 499 725 1
48 1080 499 1080 1
64 1451 499 1451 1
128 2902 299 2902 1
256 5804 99 5804 1
512 11608 99 11608 1
As expected the period and constraint values are directly related to
the buffer size, but I don't understand how the value of the
computation parameter are choosen.
Any comments?
Regards
Stephane Letz
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.