2.5 Priority Queues

Instead of having just one round table, an RTK supporting priority queues has multiple round tables. The server (processor) always serves the `high priority' round tables first. If the highest priority round table is empty, the server then moves to the second highest priority round table. The process is repeated until the processor finds a round table with a thread awaiting service.

If all round tables are empty, the processor should monitor the tables so that it can start to serve whenever a thread arrives at a table.

Priority queues are useful when you have things that must be done on time and others that can `give or take a little'.

Many cheap2 RTKs do not support Round Robin and priority queues together. Some RTKs only allows one thread per priority.

In our example, operator communication needs the lowest priority because answering a query late has the least effect on the overall behavior of a robot. Motion control and sensor reading, on the other hand, should be in the highest priority round table because both have hard real-time constraints.

Copyright © 2008-10-25 by Tak Auyeung