On Apr 22, 2010, at 12:28 PM, Peter Zijlstra wrote:
Since that reference is a bit coarse-grained, let me clarify by pointing out the actual implementation.
In particular, if you look at /usr/include/mach/thread_policy.h (on OS X, of course), you'll find:
I.e., THREAD_TIME_CONSTRAINT_POLICY implements the sporadic task model.
Global EDF is implemented in osfmk/kern/sched_prim.c (line numbers pertain to XNU 1504.3.12):
In line 473:
Further, in choose_processor() starting at line 26:
And in thread_setrun() at line 2482:
This Global EDF implementation might have been inherited from RT Mach, but I'm not sure about that.
In LITMUS^RT [1], we implement Global EDF a bit differently. Instead of iterating over all processors, we keep the processors in a max heap (ordered by deadline, with no RT task == infinity). The xnu variant may be beneficial if you only expect a few RT tasks at any time, whereas ours is based on the assumption that most processors will be scheduling RT tasks most of the time.
- Björn
[1] http://www.cs.unc.edu/~anderson/litmus-rt (The posted patch is horribly out of date; we'll have something more recent based on 2.6.32 up soon.)
---
Björn B. Brandenburg
Ph.D. Candidate
Dept. of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~bbb
--