26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG. The kernel’s role<br />

The following flowchart shows the decisions that the kernel makes:<br />

Enter on a rescheduling event<br />

Find the running thread<br />

Did we<br />

just<br />

READY a<br />

higher-priority<br />

thread?<br />

Yes<br />

Remove the current thread<br />

from the RUNNING array, and<br />

run the new thread instead<br />

No<br />

Is the<br />

currently<br />

running thread<br />

running<br />

RR?<br />

No<br />

Continue running this thread<br />

until the end of its timeslice<br />

Yes<br />

Has it used<br />

more than one<br />

timeslice?<br />

No<br />

Yes<br />

Is there<br />

another READY<br />

thread at this<br />

priority?<br />

No<br />

Rest the thread's timeslice<br />

counter<br />

Yes<br />

Reshuffle the queue so that this<br />

(running) thread is at the end of the<br />

READY queue for its priority, and<br />

remove the thread from the head of the<br />

READY queue and run it<br />

Scheduling roadmap.<br />

For a multiple-CPU system, the rules are the same, except that multiple CPUs can run<br />

multiple threads concurrently. The order that the threads run (i.e., which threads get to<br />

run on the multiple CPUs) is determined in the exact same way as <strong>with</strong> a single CPU<br />

— the highest-priority READY thread will run on a CPU. For lower-priority or<br />

April 30, 2009 Chapter 1 • Processes and Threads 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!