Re: More thread scheduling observations
Re: More thread scheduling observations
- Subject: Re: More thread scheduling observations
- From: Andy Bull <email@hidden>
- Date: Sat, 4 May 2002 19:44:25 +0100
On Saturday, May 4, 2002, at 11:49 am, Kurt Revis wrote:
>
I spent some time yesterday playing around with my code which
implements a feeder thread (reading audio from a file) which
>
communicates with my IOProc via a ring buffer. I have some interesting
observations -- anyone have any experience with this >sort of thing, or
comments?
Kurt, I love your VM trick, well found!
>
THREAD_PRECEDENCE_POLICY
In my feeder thread, I start an ordinary NSThread and in it I
execute the code below, so far I've had no detectable dropouts with this
priority setting (on a b/w g3 400 and new iMac 800) even if I resize and
move windows for a minute or two. Original priority of the thread is
normally 31, increased to 64 (or even around 50) it seems good. But I
must say that I do not know what real effect on the rest of the system
this has or even if this is kosha code! Any comments are welcome ...
.... at the start of an NSThread method ...
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
pthread_t tid;
int priority, policy;
struct sched_param param;
// Set a higher than normal thread priority
tid = pthread_self();
if ( pthread_getschedparam(tid, &policy, ¶m) == 0 ) {
TRACE1_(@"pthread_getschedparam: original priority = %d",
param.sched_priority);
TRACE1_(@"pthread_getschedparam: original policy = %d", policy);
priority = 64; // 0 = low, 127 = highest ?
// policy = SCHED_OTHER;
param.sched_priority = priority;
if ( pthread_setschedparam(tid, policy, ¶m) == 0 ) {
TRACE1_(@"pthread_setschedparam: new priority = %d", priority);
TRACE1_(@"pthread_setschedparam: new policy = %d", policy);
}
}
Andy.
Living Memory.
www.cellsynth.com
_______________________________________________
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.