RTOS Task Control Functions

A real-time operating system (RTOS) supports functions that initialize, spawn and activate all new tasks. It enables the gathering of information on existing tasks within the system to facilitate task naming, checking the status of given tasks and providing options for task execution like specific memory models or use of co-processors and task deletion(note that deletion needs special precautions in regards to semaphores for shared memory tasks.)


RTOS task control functions include:

Task Context

Once a task is switched, the execution context represented by program stack, registers, and counter contents is saved by the OS in a data structure known as a task control block to ensure that the task resumes when rescheduled. The context must be restored from the task control block once the task state is set to running.

Download Transform Windows into an RTOS

Task Scheduling and Dispatch

Task scheduling and dispatch ensure that every task accesses the CPU as well as other system resources effectively to ensure timely and successful completion of system computations. This is carried out efficiently from a resource utilization point of view with correct synchronization, with data and code protection for single tasks processing against incorrect interference. Hence, different task scheduling and dispatch models must be used because the appropriateness of OS models depends on the application features in use.

Cyclic executiveis the simplest task scheduling and dispatch model, in which computing tasks must be run occasionally in cycles through a static sequence. It is a monolithic program that runs tasks in a loop and according to their preferred order. The duration allotted to tasks and their execution sequences are determined a priori and should not vary at runtime. Systems running under cyclic executive are mainly employed for industrial machine controllers like programmable logic controllers that perform fixed task sets as fixed orders issued by the system user. Cyclic executive systems are simple to develop as well as to configure and are faster than complex systems because their task context switching tends to be quick and less frequent. However, they are mainly custom developed with low-level programming languages for special hardware platforms.

Download the RTX64 Product Brief


This is a cooperative multitasking model whose tasks are distributed over some processes referred to as coroutines. The tasks exchange program control mutually as opposed to relinquishing it to the RTOS, so every task transfers control to other scheduled tasks once its data and control state is saved. However, the scheduling responsibility,i.e. determining the tasks that get control of the processor at a specified time, is performed by the programmer as opposed to the OS. The task that transfers control is usually left in a blocked or waiting state. These characteristics have earned this model a different form of multithreading.


In most cases, task scheduling and dispatch must be responsive to timing and external signals. However, it should not be assumed that running tasks can transfer control to dispatchers on their own. When such scenarios occur, the interrupt capabilities available on all processors are used to facilitate task switching. Different tasks in the system are either switched by software or hardware interrupts. Hardware interrupts occur periodically from clocks or asynchronously through external devices. Software interrupts occur due to the execution of special software instructions written in different codes or as a result of processing exceptions like the division of zero errors.

Task loading levels vary based on mission profiles and emergency situations. Most tasks under a RTOS are mission critical, making a fully featured RTOS the ideal choice for complex embedded systems where task loading varies and includes hard real-time tasks of different periods and deadlines.

Start a Trial


Leave a Comment

  • 7 + nine =