X hits on this document

50 views

0 shares

0 downloads

0 comments

11 / 20

R8C Family General RTOS Concepts

Scheduler

The scheduler keeps record of the state of each task and selects from among them that are ready to execute and allocates the CPU to one of them. A scheduler helps to maximize CPU utilization among different tasks in a multi-tasking program and to minimize waiting time. There are generally two types of schedulers: non-preemptive and priority-based preemptive.

Non-preemptive scheduling or cooperative multitasking requires the tasks to cooperate with each other to explicitly give up control of the processor. When a task releases the control of the processor, the next most important task that is ready to run will be executed. A task that is newly assigned with a higher priority will only gain control of the processor when the current executing task voluntarily gives up the control. Figure 10 gives an example of a non-preemptive scheduling

Figure 10 Non-preemptive Scheduling

Priority-based preemptive scheduling requires control of the processor be given to the task of the highest priority at all time. In the event that makes a higher priority task ready to run, the current task is immediately suspended and the control of the processor is given to the higher priority task. Figure 11 shows an example of a preemptive scheduling.

Figure 11

Preemptive Scheduling

Dispatcher

The dispatcher gives control of the CPU to the task selected by the scheduler by performing context switching and changes the flow of execution. At any time an RTOS is running, the flow of execution passes through one of three areas: through the task program code, through an interrupt service routine, or through the kernel.

RES05B0008-0100/Rev.1.00

January 2010

Page 9 of 18

Document info
Document views50
Page views50
Page last viewedThu Dec 08 04:27:07 UTC 2016
Pages20
Paragraphs395
Words6183

Comments