Schedulers, pluggable and realtime
The patch works by splitting the large body of code in kernel/sched.c into public and private parts. Code meant to be shared between schedulers goes into a new scheduler.c file, while the current (and default) scheduler stays put. Also added to scheduler.c is a new structure (struct sched_drv) containing pointers to the functions which handle scheduling tasks. These functions are invoked for various process events (fork(), exit(), etc.), to obtain scheduling-related information, and, of course, for calls to the core schedule() function. Implementing a new scheduler is simply a matter of writing replacements for the relevant functions and plugging the whole thing in.
There have been few objections to the pluggable scheduler implementation. Ingo Molnar, however, is strongly opposed to the idea in the first place:
Ingo's position is that having one core scheduler forces developers to think about the whole problem, rather than one small piece of it. In particular, claims Ingo, the scheduling domains patch would never have come about if the kernel had pluggable schedulers; instead there would be a separate NUMA scheduler, an SMP scheduler, and so on.
Ingo, meanwhile, continues his efforts to make the One Big Scheduler provide real-time response. The latest patch is -RT-2.6.10-rc1-mm2-V0.7.1. The biggest change in recent times is a new semaphore/mutex implementation which sticks closer to the original Linux semaphore semantics; this change allows a number of patches switching parts of the kernel over to the completion interface to be dropped.
The new semaphores also include a priority inheritance mechanism. Whenever
a process blocks on a semaphore, the kernel checks to see if that process
has a higher priority than the process currently holding the semaphore. If
so, the holder's priority is bumped up to match that of the blocking
process. This technique should help to avoid situations where a
low-priority process can keep higher-priority tasks from running for
extended periods of time.
| Index entries for this article | |
|---|---|
| Kernel | Realtime |
| Kernel | Scheduler |