Next: Initializing the PIC
Previous: OSKit's Startup Code- Introduction
For achieving preemptive scheduling, you need a mechanism by which your
schedule function can get invoked periodically.
While implementing the Linux thread
package, you could achive this by registering timer with alarm/setitimer.
However this facility is not available in Oskit. (for reasons
explained in previous section).
While porting your thread package to the real hardware, you would have to use
the PIT. Its basically a hardware timer, which you can program, to generate
interrupts periodically (at certain regular intervals). You would
have to use this PIT (every OS uses it), for peridoically invoking
your schedule function.
To use the PIT three things are required.
- Initializing the Priority Interrupt Controller
- Programming the PIT, to generate interrupts at regular intervals
- Registering your schedule function as the ISR for PIT interrupts