scheduler code and task_struct

From: Daniel Rosenthal
Date: Sun Jul 20 2008 - 12:38:46 EST

I'm implementing a process scheduling algorithm (Sporadic Server,
SCHED_SPORADIC in POSIX) and there is some algorithm specific
per-process information that I have to maintain somewhere. Also, the
algorithm must take more (per-process) parameters than just the int
sched_priority parameter in sched_param. It looks like the most
appropriate place to put this information is in task_struct, this kind
of looseleaf information clutters it up. Where should this
information go? It seems like this dilemma affects more than just
this specific algorithm, but it would affect any more sophisticated
algorithms in the future which make use of more than just a priority
parameter and a timeslice for the currently running task.

What I've done so far is add a struct __sched_settings and struct
__sched_state to task_struct, which could be used by any scheduler
(both of these should perhaps be unions instead). I've also added an
event queue to every runqueue that gets triggered on scheduler_tick()
and hrtick() since the algorithm has to maintain a list of execution
capacity replenishment events that are always scheduled to happen in
the future. I'm not sure either of these are the most general or
extensible solution. Any ideas (not just specifically for this
algorithm, but to provide more robust generic facilities for new
scheduling algorithms in the future)?

Please CC me personally in any replies because I'm not subscribed to
the mailing list.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at