Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Discussion on ticksize vs. timeslice and scheduling in QNX4
Ref. No. QNX.000009559
Category(ies) Utilities, Development
Issue What is the difference between ticksize and timeslice in QNX4 and what effect does it have on scheduling?

Solution There can be a confusion between timeslice, ticksize and scheduling.  First the timeslice is actually 50 ms (5 clock ticks).  The keypoint, though, is that scheduling does not occur only at the end of a timeslice -- anything that gives the kernel control can be a scheduling event, included in that are interrupts (and 5 interrupts are a timeslice, which is a specific time when a scheduling change might be made), or any kernel call.

So, the kernel determines if a context switch needs to be done on every kernel call, so they don't wait for a timeslice (50ms) or even a timer interrupt (10ms) to occur.  If you call Send(), that is a kernel call, and the kernel blocks your process, and sees whether a new process has been made ready, makes that change, then determines what process needs to run, and does the context switch to that process.

The kernel doesn't need to wait for an irq to get control because you give it control when you make a kernel call.  Similarly if you call Receive(), Yeild(), Reply() or any other kernel call.

On the 10ms tick (configurable -- see ticksize utility), the kernel does various bits of housekeeping, the most important are increasing the system time by one tick (10 ms by default) and checking for (and handling) the expiry of timers; it also checks for the completion of a timeslice for any program running round-robin and other stuff.

An important thing to remember is that timeslices are only relevant for Round-Robin (and Adaptive) scheduling algorithm processes, running READY that have another process also running READY at the same priority.  Most real-time processes will run FIFO scheduling, so the timeslice is not a particularly important value.