Why use a multitasking RTOS?
Multitasking allows you to better utilize CPU resources. Multitasking allows you to design a system that is event driven and allows you to react and handle events from the system when they occur instead of looking for an event and processing it when found. If one event has higher priority than another (e.g., a pump failure signal versus a refresh of a display), Q▪Kernel can immediately run the higher priority thread regardless of what was being done, and get back to the lower priority ones when it has completed the higher priority ones. If polling had been employed and a lower priority function was just invoked before the higher priority one, it would go unrecognized until polled (programmatically) in the code or until the lower priority code has completed.
Applications that don’t use a multitasking RTOS must use the “superloop” approach. A “superloop” application is basically a program that runs in an endless loop, calling functions to execute the appropriate operations. No real-time kernel is used, so Interrupt Service Routines (ISRs) must be used for real-time parts of the software or critical operations (interrupt level). This type of system is typically used in small and simple systems.
“Superloops” can become difficult to maintain if the program becomes too large. Because one software component cannot be interrupted by another component (only by ISRs), the reaction time of one component depends on the execution time of all other components in the system. Deterministic behavior is therefore poor.