A real-time operating system (RTOS) is a specific type of operating system that performs functions and calculations within a specified time. It prioritizes tasks and can suspend one in favor of another with a higher priority, ensuring that it processes the more important task first. However, along with the benefits of using an RTOS, it also has several drawbacks, including the cost of the operating system and its complicated implementation.
The two main types of RTOS are soft real-time (SRT) and hard real-time (HRT). An HRT has the ability to guarantee that it will always process operations within a guaranteed time frame, while an SRT can only guarantee the same results most of the time. This helps the SRT optimize non-critical elements of an application, which an HRT does not do. SRT systems are not reliable in situations where critical deadlines need to be met, such as in medical equipment or engine control systems, where even a minor latency can have catastrophic results. On the other hand, using an HRT in non-critical systems, such as streaming Internet broadcasts, will result in the HRT doing extra work and using excessive system resources unnecessarily.
An RTOS needs to have greater multitasking capabilities than a non-RTOS so it can prioritize multiple process threads. The size of an RTOS means that it can provide greater performance than a non-RTOS because it uses less multitasking overall, but this is not a rule. The other parts of the computer system, including the CPU and memory, determine the effectiveness of an RTOS. Due to the complex scheduling in an RTOS, it requires more coding to perform effectively than a non-RTOS and therefore requires more space on a computer system.
An RTOS uses advanced algorithms to schedule tasks. This allows it the flexibility it needs to prioritize applications, but also means it requires greater resources and time. Over a given time period, an RTOS tends to complete less work than a non-RTOS. An RTOS often needs to access components such as device drivers, which factors into the amount of time it takes to complete certain tasks. Also, an RTOS requires more interrupt signals than a non-RTOS. An interrupt measures the time it takes between when an operating system creates the interrupt and when it processes it. An RTOS needs to guarantee a maximum time it may take to process the interrupt.