Unit - I Real Time Operating System
Content : Operating System Concepts Real-Time Tasks Real-Time Systems Types of Real-Time Tasks Real-Time Operating Systems
Operating System Concepts : Component of an Operating System : Processor Management Memory Management Primary Secondary Cache Virtual File Management I/O Management Multiprogramming Protection and Security Network Management
Kernel Architecture (UNIX) : Library hardware File Subsystem character block Hardware control Buffer Cache system call interface Device driver Inter process communication Scheduler Memory Management Process Control Subsystem User program User level kernel level User level kernel level
Monolithic Kernel : User Mode Kernel Mode
Micro Kernel : User Mode Kernel Mode
Hybrid Kernel : User Mode Kernel Mode
Types of kernel : Monolithic Kernel One single program that contains all of the code performing kernel operations. Less software involved hence faster execution. Less code generally means less bugs. Single error need recompilation of whole kernel functionalities. Microkernel Only core kernel functionalities are together all other functions of are written in modules. Maintenance is generally easier. Rapid development time as new addition doesn’t need to disrupt kernel.
Operating System Concepts : Process States New Ready Running Blocked Exit Process Control Block PID State Register status Scheduling information Pointers to memory I/O resource information Multitasking CPU and IO Bound Tasks Scheduling Algorithms
Operating System Concepts : Threads Common address space Individual stack and registers Interrupt Handling Save current context Determine identity of interrupt Switch to new context Start execution of interrupt Inter-Process Communication Shared Memory Message Passing Semaphores Message Pipes Transfer Protocol Blocking Sender, Blocking Receiver Non-blocking sender, Blocking Receiver Remote Procedure Call Interrupt Latency
Operating System Concepts : Critical Section Race Condition Producer Consumer Reader Writer Problems Deadlock Necessary conditions Prevention Avoidance Detect and Recover
Real-Time Tasks Time constrained tasks Useful only if output generated within deadline Terms: Release/Ready Time Scheduling Time Completion Time Burst/Run Time Deadline Tardiness: When completion time > deadline Completion time - Deadline Laxity: Time the task can wait without missing deadline Deadline – Completion time
Types of Real-Time Tasks : Hard Real-time task Must condition C <= D Air traffic control Vehicle subsystems control Nuclear power plant control Soft Real-time Task If C > D then penalty is associated with delay in results. Multimedia transmission and reception Networking, telecom/cellular networks Web sites and services Computer games Firm Real Task
Real-Time Systems : Periodic Task Executes regularly after fixed intervals Aperiodic Task Jobs arriving at irregular intervals Soft deadlines have time constraints either for deadlines or start Sporadic Task Aperiodic tasks with hard deadlines Pre-emptible Non-preemptible Tasks
Real-Time Operating Systems : Simpler embedded systems use superloop-based approach. Complex embedded systems require dedicated OS Smart phones Abstraction layer between hardware and application layer. Task management Inter Task Communication and Synchronization Dynamic Memory Allocation Device I/O supervisor Timers
Real-Time Scheduling : Off-Line Scheduling / Pre-Run Time Scheduling : Total tasks, Deadlines, Release time, Execution time all must be known Inflexible Optimal for systems where jobs are fixed. Online Scheduling : Static Priority Preemptive Non-preemptive Dynamic Priority Priority can be changed at runtime Planning Based Best Effort
Classes of Real-Time Scheduling Algorithms Static Priority Non- Preemptive Preemptive Dynamic planning-based Feasibility determined at run time Guarantees execution of accepted tasks Dynamic best effort No feasibility analysis is performed. All hard real time tasks’ deadlines are met. Aborts any started process whose deadline is missed.
Rate Monotonic Scheduling: Assigns priorities to tasks on the basis of their time periods Highest-priority task is the one with the shortest period Sufficient but not necessary condition Static Priority with preemption C i / P i ≤ n(2 1/n - 1) Task SizeBound
Earliest Deadline First : Dynamic Priority Allocation Priority changes at runtime Highest priority to task with nearest deadline Can be used for tasks where RM fails. Overhead for implementation.
Two Tasks
Periodic Scheduling
Problem: Static Priority TasksPriorityPeriodCPU Burst T1172 T22174 T33248 Draw the Gantt-chart for scheduling these tasks. Assume the all jobs have same release time Schedule the process to meet their deadline Without Pre-emption With Pre-emption Note: Deadline of task is the time when its next burst arrive
Example CPU utilization for the set of task: LHS : 2/7 + 4/17 + 8/24 = RHS : = 3 X (2 1/3 -1)= 3 x.26 =.78 LHS> RHS :RM does not get satisfied But the task still might get schedulable by RM technique TasksPeriod (T)CPU Burst(C) T172 T2174 T3248
Problem 1 TasksPeriod (P or T)CPU Burst(C) T1154 T2122 T3205 Find out whether above problem is solvable using Rate Monotonic Scheduling.
Problem 2 TasksPeriodCPU BurstRelease Time T1310 T21031 T31543 Find out whether above problem is solvable using Rate Monotonic Scheduling.
Example TasksPeriodCPU Bursts T141 T262 T394 Solve using Rate Monotonic EDF
Example TasksPeriodCPU Bursts T1105 T2122 T3153 T4246 Is it possible to solve above set of tasks using EDF
Qualities of good RTOS Performance: Must be capable of meeting the requirements of application Reliability: System should not fail. “Mean Time between Failure” should be very high. Compactness: Size of RTOS should be as small as possible. (Ported to embedded systems mostly with limited memory) Scalability: Modularity in OS design. Can be scaled up or down.