Adding a new scheduling algorithm to Fiasco.OC
adam at os.inf.tu-dresden.de
Wed Jul 2 00:30:05 CEST 2014
On Mon Jun 30, 2014 at 12:08:00 +0200, Valentin Hauner wrote:
> I've added a new config directive for 'sched_edf' to the Modules.* files
> in 'kernel/fiasco/src', that is:
> PREPROCESS_PARTS-$(CONFIG_SCHED_EDF) += sched_edf
> This enables the user to compile the kernel with EDF scheduling when
> setting this directive, right?
This adds the preprocess tag 'sched_edf' which are used in the
expressions for the INTERFACE and IMPLEMENTATION blocks. With that you
can chose whether a block of code is included in compilation or not.
> I want to implement the preemptive EDF algorithm, i.e. any running task
> must be preempted if a new task with a shorter deadline arrives.
> dominates() from sched_context-edf.cpp and next_to_run() from
> ready_queue_edf.cpp are designed to choose the one with the shortest
> deadline, but how can I tell Fiasco to act preemptive?
So, on one CPU only one thread can be running at a time. Others might be
ready to execute but not running. Regarding preemption, the timer
interrupt drives scheduling (see Thread::handle_timer_interrupt) which
calls schedule() whenever there's something to do, i.e. a timeout has
expired. Of course schedule() might also be called for other reasons,
for example when threads change their ready state. In the scheduler
implementation you'll see whenever some new thread arrives or one
leaves, so I think the preemption as you need it is already there.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers