|
MQX
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tasks
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Scheduling policiesEach task is assigned a priority level. Many tasks may co-exist at a priority level.
Under the round-robin scheduling, a task is allocated an interval of time (time slice) to run. At the end of the time slice and if the task has not completed, the task yields to the next task at the same level of priority. A task can execute if and only if no higher priority tasks are ready. Ready Queues.Tasks at each priority level are arranged in a queue. This is implemented in the kernel through the ready-queue structure which is a linked list of task descriptors. Each task that becomes ready, is entered at the tail of the queue at its priority level. The scheduler scans the ready queue starting at the highest priority proceeding towards the lowest priority level. It starts scheduling tasks that it finds being READY at the first "populated" level encountered.
Task Descriptor Structure
Blocked TasksWhen a task ceases to be active, its context is saved in a BLOCKED_STATE_STRUCT on the task's stack which is hardware dependent. For example the format of the BLOCKED_STATE structure is:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||