Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The scheduler assigns work to resources that complete the work. In the following Real-time operating System (RTOS) scheduler will be discussed.

Scheduling Concepts

To provide concurrency, different scheduling concepts, essentially distinct into cooperative- and pre-emptive. More information on Algorithms.

Cooperative Scheduling

In cooperatively designed Multitasking concepts a context switch is performed when a task suspends itself via taskYIELD().

Image RemovedImage Added

In poorly designed systems a Task can consume all CPU time for itself (e.g. extensive calculations, busy waiting, etc.) which causes a System Freeze. This is why most systems are designed pre-emptive.

Pre-emptive Scheduling

The freeRTOS Kernel can temporarily interrupt a task with the Intention of resuming later. In the meantime the freeRTOS Kernel can give the processor capacity to another Task. This method is called context switching and the System that carries out the Interrupt is called scheduler.

Image RemovedImage Added

The time a process is allowed to use the CPU core is called "time slice" and is critical to balance system performance vs process responsiveness.

...

  • Rate-monotonic scheduling
  • Round-robin scheduling
  • Fixed priority pre-emptive scheduling, an implementation of pre-emptive time slicing
  • Fixed-Priority Scheduling with Deferred pre-emption
  • Fixed-Priority non-pre-emptive scheduling
  • Critical section pre-emptive scheduling
  • Static time scheduling

Round Robin scheduling

Fixed Priority scheduling

Earlyiest Deadline First approach

The earliest deadline first approach places processes in a priority queue. On scheduling event the Task closest to its deadline is the next to be executed. See hereA Round Robin (RR) Scheduling Algorithm gives each task a time slot to process its job. When the time slot has reached its end, the processing gets interrupted and the next task has its time slot to process. In FreeRTOS this concept is called Time-Slicing and can be altered defining configUSE_TIME_SLICING. If disabled (set to 0) tasks of equal priority will not switch between one another until one has finished its job.

Fixed Priority scheduling

A Fixed-priority Scheduling Algorithm ensures that the task with the highest priority is processed first. This concept is used by default.

Available schedulers in FreeRTOS


FreeRTOS example

The graphic shows how different Tasks can get processor resources by the scheduler.

...