Both operating systems and real time operating systems utilize a scheduler to decide which program to run when, but real time operating systems are designed to provide a predictable execution pattern. Real time operating systems also have real time requirements specifying that a response be completed within a defined time.
An operating system, or OS, gives the appearance of allowing multiple programs to execute at the same time. However, a processor core can only run a single thread of execution at a time. The scheduler that is utilized by both OS and RTOS, or real time operating systems, rapidly switches between programs and gives the illusion of synchronous execution. However, the scheduler in RTOS provides a predictable or deterministic execution pattern. Real time requirements specify that an embedded system respond to an event within a defined time or deadline. Most often, users assign a priority to each thread of execution to achieve determinism using real time schedulers.
As an application grows in complexity or size, there are certain benefits to using an RTOS as opposed to an OS. These benefits include modularity, cleaner interfaces, maintainability, code reuse and idle time. Other benefits include improved efficiency, easier control over peripherals and flexible interrupt handling.