- OS - Home
- OS - Overview
- OS - History
- OS - Evolution
- OS - Functions
- OS - Components
- OS - Structure
- OS - Architecture
- OS - Services
- OS - Properties
- Process Management
- Processes in Operating System
- States of a Process
- Process Schedulers
- Process Control Block
- Operations on Processes
- Process Suspension and Process Switching
- Process States and the Machine Cycle
- Inter Process Communication (IPC)
- Remote Procedure Call (RPC)
- Context Switching
- Threads
- Types of Threading
- Multi-threading
- System Calls
- Scheduling Algorithms
- Process Scheduling
- Types of Scheduling
- Scheduling Algorithms Overview
- FCFS Scheduling Algorithm
- SJF Scheduling Algorithm
- Round Robin Scheduling Algorithm
- HRRN Scheduling Algorithm
- Priority Scheduling Algorithm
- Multilevel Queue Scheduling
- Lottery Scheduling Algorithm
- Starvation and Aging
- Turn Around Time & Waiting Time
- Burst Time in SJF Scheduling
- Process Synchronization
- Process Synchronization
- Solutions For Process Synchronization
- Hardware-Based Solution
- Software-Based Solution
- Critical Section Problem
- Critical Section Synchronization
- Mutual Exclusion Synchronization
- Mutual Exclusion Using Interrupt Disabling
- Peterson's Algorithm
- Dekker's Algorithm
- Bakery Algorithm
- Semaphores
- Binary Semaphores
- Counting Semaphores
- Mutex
- Turn Variable
- Bounded Buffer Problem
- Reader Writer Locks
- Test and Set Lock
- Monitors
- Sleep and Wake
- Race Condition
- Classical Synchronization Problems
- Dining Philosophers Problem
- Producer Consumer Problem
- Sleeping Barber Problem
- Reader Writer Problem
- OS Deadlock
- Introduction to Deadlock
- Conditions for Deadlock
- Deadlock Handling
- Deadlock Prevention
- Deadlock Avoidance (Banker's Algorithm)
- Deadlock Detection and Recovery
- Deadlock Ignorance
- Resource Allocation Graph
- Livelock
- Memory Management
- Memory Management
- Logical and Physical Address
- Contiguous Memory Allocation
- Non-Contiguous Memory Allocation
- First Fit Algorithm
- Next Fit Algorithm
- Best Fit Algorithm
- Worst Fit Algorithm
- Buffering
- Fragmentation
- Compaction
- Virtual Memory
- Segmentation
- Paged Segmentation & Segmented Paging
- Buddy System
- Slab Allocation
- Overlays
- Free Space Management
- Locality of Reference
- Paging and Page Replacement
- Paging
- Demand Paging
- Page Table
- Page Replacement Algorithms
- Second Chance Page Replacement
- Optimal Page Replacement Algorithm
- Belady's Anomaly
- Thrashing
- Storage and File Management
- File Systems
- File Attributes
- Structures of Directory
- Linked Index Allocation
- Indexed Allocation
- Disk Scheduling Algorithms
- FCFS Disk Scheduling
- SSTF Disk Scheduling
- SCAN Disk Scheduling
- LOOK Disk Scheduling
- I/O Systems
- I/O Hardware
- I/O Software
- I/O Programmed
- I/O Interrupt-Initiated
- Direct Memory Access
- OS Types
- OS - Types
- OS - Batch Processing
- OS - Multiprogramming
- OS - Multitasking
- OS - Multiprocessing
- OS - Distributed
- OS - Real-Time
- OS - Single User
- OS - Monolithic
- OS - Embedded
- Popular Operating Systems
- OS - Hybrid
- OS - Zephyr
- OS - Nix
- OS - Linux
- OS - Blackberry
- OS - Garuda
- OS - Tails
- OS - Clustered
- OS - Haiku
- OS - AIX
- OS - Solus
- OS - Tizen
- OS - Bharat
- OS - Fire
- OS - Bliss
- OS - VxWorks
- Miscellaneous Topics
- OS - Security
- OS Questions Answers
- OS - Questions Answers
- OS Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
Real-Time Operating System (RTOS)
In previous chapters, we learned about how different operating systems are designed to maximize CPU usage and efficiency. However, in some systems, it is important to respond immediately than just maximizing CPU usage. For example, you press the brake pedal in a car, the car's OS calculates that to maximize CPU usage, first finish playing the current song then apply brakes. Obviously, this is not acceptable.
In such cases, we need the operating system to give priority to critical tasks. This is where real-time operating systems (RTOS) comes into play. Read this chapter to understand more about real-time operating systems, its working, advantages, disadvantages, and examples.
- What is Real-Time Operating System?
- Working of Real-Time Operating System
- Types of Real-Time Operating Systems
- Advantages of Real-Time Operating System
- Disadvantages of Real-Time Operating System
What is Real-Time Operating System?
The real-time operating system (RTOS) is a type of operating system that is designed to process data and events in a deterministic manner within a specified time constraint. Meaning, this types of os should ensure a task must be completed within a defined time limit, known as a deadline. The main goal of an RTOS is to provide reliable and predictable response times for critical systems like industrial control systems, medical devices, automotive systems, and aerospace applications.
The idea behind real-time operating systems is to give priority to tasks based on their urgency and importance. For example, in an airbag system of a car, the RTOS must respond to a collision event within milliseconds to deploy the airbags and protect the passengers. So the process responsible for deploying the airbags will have a higher priority than any other tasks running on the system.
Working of Real-Time Operating System
The working of a real-time operating system is based on the concept of task prioritization and preemption. This can be understood by −
- Every task in an RTOS is assigned a priority level based on its importance and urgency.
- The CPU scheduler in the RTOS will ensure that the CPU is always executing the highest-priority task that is ready to run.
- If a higher-priority task becomes ready to run while a lower-priority task is executing, the RTOS will preempt the lower-priority task and allocate the CPU to the higher-priority task.
Types of Real-Time Operating Systems
There are three main types of real-time operating systems:
Hard Real-Time OS
In a hard real-time operating system, tasks must be completed within their specified deadlines. If a task misses its deadline, it can lead to big problems. This will guarantees that all the critical tasks are completed on time. Examples of hard real-time systems include flight control systems, medical devices, and industrial control systems.
Key Features
- Deterministic Nature for critical tasks
- Strict Deadline
- High Reliability
- No toleration for missed deadlines
Soft Real-Time OS
In a soft real-time operating system, tasks do have deadlines, but missing a deadline is not that problematic. The system can still function correctly even if some tasks miss their deadlines sometimes. Soft real-time systems are used in applications like multimedia systems, online gaming, and video streaming.
Key Features
- Higher throughput due to flexibility
- Deadlines are important but not followed strictly
- Not suitable for critical applications
Firm Real-Time OS
Firm real-time operating systems are something that is in middle of hard and soft real-time systems. In this type of system, tasks have deadlines, and missing a deadline can lead to a loss of system performance, but it does not create a complete system failure. For example, in a video conferencing system, if a video frame is not delivered on time, it may result in a temporary drop in video quality, but the system can still function.
Key Features
- Deadlines are important, but frequent misses are not tolerated
- Balance between performance and reliability
General-Purpose OS vs Real-Time OS
General-purpose operating systems (GPOS) like Windows, Linux, and macOS are designed to maximize CPU usage and provide a good user experience. The main differences between GPOS and RTOS are −
| Aspect | General-Purpose OS | Real-Time OS |
|---|---|---|
| Objective | Maximize CPU usage and provide a good user experience. | Ensure critical tasks are completed within specified deadlines. |
| Task Scheduling | Uses time-sharing and priority-based scheduling. | Uses priority-based scheduling with preemption for non critical tasks. |
| Response Time | May have variable response times. | Provides deterministic and predictable response times. |
| Use Cases | Used in personal computers, servers, and mobile devices. | Used in embedded systems, industrial control systems, and safety-critical applications. |
Advantages of Real-Time Operating System
Some of the advantages of real-time operating systems are −
- Reliability − RTOS are designed to be highly reliable environments where critical tasks must be completed on time.
- Deterministic Behavior − RTOS provide predictable response times, which is essential for time-sensitive applications.
- Useful in Embedded Systems − RTOS are widely used in embedded systems, where real-time performance is crucial.
Disadvantages of Real-Time Operating System
Some of the disadvantages of real-time operating systems are −
- Less Efficient CPU Usage − RTOS prioritize certain tasks over others, this may lead to less efficient CPU usage compared to general-purpose operating systems.
- Complexity − Designing and implementing an RTOS is more complex.
- Extra hardware Requirements − It needs specific device drivers and interrupt signals to respond earliest to interrupts.
Conclusion
Real-time operating systems ensure that critical tasks are completed within specified deadlines. They are widely used in embedded systems, industrial control systems, and safety-critical applications. It works by giving a priority number to each task in the system and ensuring that the CPU is always executing the highest-priority task that is ready to run. The main issue with RTOS is that it may lead to less efficient CPU usage and increased complexity in design and implementation.