Using interrupts to control scheduling decisions in base-hw

Stefan Kalkowski stefan.kalkowski at ...1...
Tue Jul 26 13:19:09 CEST 2016

Hello Adrian,

On 07/14/2016 02:42 PM, Adrian Hengelhaupt wrote:
> Hello,
> My task is to implement a preemptive scheduler for a zynq-board. 
> Therefore I've tried to figure out how the cpu_scheduler program in 
> repos/baseh-hw/run/ works and whether it can be used as 
> a foundation for my task.

the cpu_scheduler target is not a "program" in the common sense. It is a
unit test for our kernel, which is executed instead of starting any
userland components (core, init) on top of the kernel. The test is
executed within the kernel context, and uses the internal kernel API to
stress the already existent scheduler implementation.
If you want to replace the existent scheduler, I think it is not the
right place to start here, because the test is inherently bound to the
current implementation.

Just out of curiosity, what kind of scheduler do you want to implement?
Maybe you can model the semantic you deserve with the existent scheduler?

> So, my question is: How can I utilize interrupts in order to make 
> subsequent scheduling decisions?

Currently, out of simplicity the kernel always asks the scheduler for a
new decision whenever the kernel is entered. This will possibly change
in the near future, but it's current state. So, whenever the kernel
timer or any other device triggered an interrupt, some other hardware
exception occurred (page-fault), or a component issued a system call,
the scheduler will be called to decide which thread is scheduled next.
The scheduler also implicitly adjusts the kernel timer by returning
"head_quota()" that is the time the currently scheduled thread can run
until the timer should fire.

To change the current implementation, please have a look at the
interface here:


and especially its implementation:



> Thanks in advance!
> Greetings
> Adrian
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are 
> consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
> J-Flow, sFlow and other flows. Make informed decisions using capacity planning
> reports.
> _______________________________________________
> genode-main mailing list
> genode-main at

Stefan Kalkowski
Genode Labs ยท

More information about the users mailing list