11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

Basic conceptsPREEMPTIVES MULTITASKINGReal-time systems like <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> operate with preemptive multitasking only. A real-time operating systemneeds a regular timer-interrupt to interrupt tasks at defined times and to perform task-switches if necessary. The highestprioritytask in the READY state is therefore always executed, whether it is an interrupted task or not. If an ISR makesa higher priority task ready, a task switch will occur and the task will be executed before the interrupted task is returnedto.Low priority taskExecuting task is interruptedISRTimeISR puts high prioritytask in READY state;task switch occursHigh priority taskHigher priority taskIs executedInterrupted taskis completedSchedulingThere are different algorithms that determine which task to execute, called schedulers. All schedulers have one thingin common: they distinguish between tasks that are ready to be executed (in the READY state) and the other tasks thatare suspended for any reason (delay, waiting for mailbox, waiting for semaphore, waiting for event, and so on). Thescheduler selects one of the tasks in the READY state and activates it (executes the program of this task). The task whichis currently executing is referred to as the active task. The main difference between schedulers is in how they distributethe computation time between the tasks in READY state.ROUND-ROBIN SCHEDULING ALGORITHMWith round-robin scheduling, the scheduler has a list of tasks and, when deactivating the active task, activates the nexttask that is in the READY state. Round-robin can be used with either preemptive or cooperative multitasking. It workswell if you do not need to guarantee response time, if the response time is not an issue, or if all tasks have the samepriority. Round-robin scheduling can be illustrated as follows:All tasks are on the same level; the possession of the CPU changes periodically after a predefined execution time. Thistime is called timeslice, and may be defined individually for every task.PP<strong>RTOS</strong>-215

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

Saved successfully!

Ooh no, something went wrong!