Re: Mach realtime thread with thread_policy_set
Re: Mach realtime thread with thread_policy_set
- Subject: Re: Mach realtime thread with thread_policy_set
- From: Jim Magee <email@hidden>
- Date: Wed, 29 Oct 2003 11:56:53 -0500
On Oct 29, 2003, at 3:01 AM, Greg Eigsti wrote:
I am experimenting with Mach real time threads (thread_policy_set
THREAD_TIME_CONSTRAINT_POLICY) and am having a problem where real time
threads don't seem to be scheduled properly (far too often). I have a
simple app that creates a pthread and then boosts the new pthread's
priority via thread_policy_set; the pthread executes continuously and
effectively stops the 'parent' thread from executing. I must note...
that my real time pthread does some garbage calculation in a while(1)
loop and calls YieldToAnyThread() to attempt to give up its time
slice. Am I missing something obvious here? I would expect my real
time thread to get regularly scheduled 'bits' of cpu time not
'continuous' cpu time.
When you define a time-constrained thread, you are saying that "when it
is able to run, I want it to run - at the expense of all other threads
except possibly other time-constrained threads." Are you sure you
really need a time-constrained thread here? The typical requirement
for using one is that you have a real world time-sensitive deadline to
meet (typically trying to provide data to a piece of hardware that is
time-based). Specifically, garbage-[sp collection] should NEVER be
done from a time-constrained thread.
I am using 1ms for my computation value (workload takes .5ms) and
1000ms for my period value. I calculate computation and value with
NanosecondsToAbsolute().
These values are simply to determine which of the time-constrained
threads to run next/first if there is more than one available to run.
They are not to define when the thread is to supposed to revert to
"normal" scheduling again. At the moment, the values aren't used at
all and all time-constrained threads are simply run round-robin (the
deadlock avoidance mechanisms are not yet in place to use those values
effectively - but they are coming so keep trying to be true to the
vaues).
Is there an API that I can use to signal that my real time thread is
done executing for this period? I have scoured the internet and have
not found a good answer.
Actually "blocking" is the only way a time-constrained thread is
expected to give up the CPU.
--Jim
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.