Task Queues

There exists four task queues, based on the four task types supported, in the following order or priority, 0 being the highest and 3 being the lowest:
  • 0 - Hard Deadline Periodic Tasks
  • 1 - Hard Deadline Aperiodic Tasks
  • 2 - Soft Deadline Periodic Tasks
  • 3 - Soft Deadline Aperiodic Tasks
Queue 0: Tasks run an indefinate number of times. Tasks are only deleted when he user explicity deletes them and recomputes the schedule. The task order is determined by Schedule_Compute(). When the scheduler reaches the end of this queue, it will immediately start back at the beginning.

Queue 1: Tasks run only once. The queue is always sorted in Earliest Deadline First (EDF), with the exception of the head. To avoid context switching more than one simultanious tasks in the queue (saves significantly on stack space and complexity), when a task is inserted into this queue it starts at Queue_HA_Head->Next. EDF was chosen because it is provably optimal. Deadline is stored in absolute system time to save computation when the queue is accessed. When a task in this queue finishes, it removes itself from the queue.

Queue 2: These tasks are scheduled as if they were hard periodic tasks by the schulder. Thus, they will not enter the queue until Schedule_Compute() is first called. When a soft periodic task is encountered by the scheduler, it will add the given task to this queue. If RESCHED_SP is not set to 1, then the scheduler will first search the queue to see if the task is already scheduled. This feature could be very useful in preventing queue overflow problems. If a user were running a task scanning withotu debouncing a keypad, then this feature would prevent filling the queue. Furthermore, to help prevent livelock problems, in this case the soft periodic task already in the queue would not be moved to the end of the queue.

Queue 3: These tasks are most likely not to ever finish so it is key that they have the lowest priority, not to mention if we want to meet deadlines. The Queue is straight forward. Tasks are pushed onto the end and shifted out the beginning.