Real Time Operating System

Real Time Operating System
  1. Real-time Operating System Questions
  2. Non Real Time Operating Systems
  3. Real Time Operating System Rtos
  4. Real-time Operating System
I don't care how; I want it now!
— Willy Wonka and the Chocolate Factory

A real-time operating system (RTOS) is designed for real-time operations meeting response time predictability and deterministic response. Main criteria are predictability and determinism, not speed. It is also possible to have both soft and hard real-time features in the same system. Windows 1 Mac Chromebook iPad Android Tablet 2; Operating System: 7+ OS X 10.11+ Chrome OS: iOS 11+ Android 7+ Screen Resolution: 1024x768+ 1024x768+ Any: Any: 8.9' Browsers. LynxOS-178 is a native POSIX, hard real-time partitioning operating system developed and certified to FAA DO-178B/C DAL A safety standards. It is the only Commercial-off-the-Shelf (COTS) OS to be awarded a Reusable Software Component (RSC) certificate from the FAA for re.

How to take a screenshot on your smartphone, tablet, notebook or desktop computer. (Some) Real-Time Operating Systems Issues. (Some, random) Issues with Real-Time OSs. Problems with the design of general-purpose real-time capable OS: Solaris J.Nieh, J.G.Hanko, J.D. Northcutt, G.A.Wall. “SVR4 UNIX Scheduler Unacceptable for Multimedia Applications.” NOSSDAV ‘93.

When we looked at scheduling policies for time-sharing systems, we foundthat attaching priorities to processes provided a convenient mechanismfor proper scheduling (favoring processes with higher priorities).Unfortunately, there are some mysteries and uncertainties involved with prioritiesas well. Let's consider the two forms:

Fixed priorities:
If we assign too many processes to high priority levels, they maykeep the CPU busy all the time and lower priority processes willstarve. Also, what priority is one to pick? Should my process bepriority level 4 or level 6? What's the difference? A priority onlymake sense when compared to the priorities of all the other processeson the system and provide no assurance of getting a certain amountof CPU time on their own. Even a high priority process can itselfstarving if an even higher priority process starts to run. If otherprocesses come in at the same level, the process may end up sharingthe CPU round-robin.
Dynamic priorities:
With dynamic priorities, our priority will be adjusted by the operating system. It may be lowered when the process has beenusing a lot of the CPU and raised for interactive jobs. At any giventime, a process generally has no idea what its priority level is.

A process frequently does not need all of the CPU time, but needsenough to finish its task in a certain, often critical, amount oftime. Consider, for example, the task of decompressing a video frameand sending it to a display device. We do not need 100% of the CPUall the time, but we need enough of it at proper intervals todecompress and send the video frames at a sustained rate of, say,30 frames per second. As another example, suppose a core meltdownwas detected at the Springfield Nuclear Power Plant. A processmanaging the corrective actions might have a very tight deadlineof 1 minute to complete its tasks.

What priority levels should we assign to these important (time-critical)tasks? If there is only one such process, we can give it the highestpriority. What if there are several time-critical processes? Theschedulers we studied for time-sharing systems were primarily designed to befair to the system and to processes or users. Their goal was to putthe CPU and system resources to the best use and to minimize averageresponse time. Unfortunately, they are generally inadequate tosupport real-time demands.

Real time operating system mcq

Real-time processes are often specified as having a starttime (release time) and a stoptime (deadline). The release time is thetime at which the process must start after some event occurred thattriggered the process. For example, suppose that a collision sensorinterrupt must start airbag deployment within 20 msec. of sensetime. The deadline is the time by which the task must complete. Thescheduler must allot enough CPU time to the job so that the taskcan indeed complete. There are several times of deadlines. Ahard deadline is one in which there is novalue to the computation if it completes after the deadline.

Some systems require even more strict scheduling because real harmcan result if the process is dispatched either too early or if itmisses its deadline. These systems are called safetycritical systems.

Luckily, most real-time demands that we can expect to encounter ongeneral purpose time-sharing computer systems fall in the categoryof soft deadlines. With a soft deadline, the valueof a late result diminishes but doesn't immediately disappear withtime. That is, you can sometimes be a little late with noharm done.Consider a video server that is required togenerate 30 video frames per second. This means that a frame has to be generated every 33.3 milliseconds. What if it is 5millisecond late? The user probably will not notice. What if it is 40milliseconds late? Well, by then we expect to present the next frame and thereis no value in the current data.

If you are serious about meeting hard deadlines or designing a safetycritical system, you will likely need to run a real-time operating systemon a system that is dedicated to those tasks and minimizes all other forms of interference.For example, you may not be able to afford wasting time servicingdisk interrupts and you certainly will not want to move memory pagesback and forth between the disk and memory for fear of the time itwill take to retrieve them if they are suddenly needed. You also willneed to ensure that your operating system has preemptable systemcalls since you don't want a process held up because the operatingsystem is tied up servicing a system call.

A real-time operating system has a well-specified maximum time for each actionthat it performs to support applications with precise timing needs. Systemsthat can guarantee these maximum times are called hard real-timesystems. Those that meet these times most of the time are called soft real-timesystems. Deploying an airbag in response to a sensor being actuated is a case whereyou would want a hard real-time system. Decoding video frames is an example ofwhere a soft real-time system will suffice. Real-time systems will usually havethe following characteristics:

  • Priority-based scheduler
  • Guaranteed maximum time to service interrupts
  • Ability to ensure that processes are fully loaded into memory and stay in memory
  • Consistent and efficient memory allocation
  • Preemptable system calls

As we start to use terms such as compute time and deadline,it helps to see how these terms relate to different categoriesof processes:

  1. Terminating processes:A terminating process may be considered as one that runs and thenexits (terminates). We are interested in the amount of time that ittakes it to run to completion. Its deadline is the time that atwhich it should complete all its work and its compute time is theamount of CPU time it needs.
  2. Nonterminating processes:For processes such as video and audio servers as well as editors,we are not interested in the terminating time of these processes butrather in the time between events. For example, we would like our audioserver to fill a 4K byte audio buffer every 500 milliseconds or we wouldlike our video server to provide a new video frame every 33.3milliseconds. For these processes, the compute time is the CPU timethat the process needs to compute its periodic event and the deadlineis the time at which it must have the results ready. Nonterminatingprocesses may be divided into two classes:

    • Periodic:A periodic process has a fixed frequency at which it needs to run.For example, a video decompressor may have to run 30 times persecond at 33.3 millisecond intervals.
    • Aperiodic:Aperiodic processes have no fixed, cyclical, frequency betweenevents. Event interrupts may occur sporadically and event computationtimes may vary dramatically. For purposes of scheduling, we use theshortest period and the longest computation time to play it safe.
Real time operating system pptReal time operating system security

The CPU cannot work magic. If we want to have our system processfour video streams at the same time at 30 frames per second andprocessing a single frame requires 40 milliseconds of CPU time,we will be forced to fail in our scheduling needs. There is just notenough CPU time to go around. If C represents our computation timeand D represents the deadline, the following relation must hold:

C ≤ D

Real-time Operating System Questions

This assures us that we will have enough CPU time to complete thetask. Moreover, for periodic tasks, the deadline must be within theperiod. If the period of the process is T, the following relationmust now hold:

C ≤ D ≤ T

Let's now look at a few popular algorithms for scheduling processes with real-time constraints.

Earliest deadline scheduling is simple in concept. Every processtells the operating system scheduler its absolute time deadline.The scheduling algorithm simply allows the process that is in thegreatest danger of missing its deadline to run first. Generally,this means that one process will run to completion if it has anearlier deadline than another. The only time a process would bepreempted would be when a new process with an even shorter deadlinebecomes ready to run. To determine whether all the scheduled processesare capable of having their deadlines met, the following conditionmust hold :


This simply tells us sum of all the percentages of CPU time used per process has to be less than or equal to 100%.

This method is similar to shortest remaining time scheduling withthe concept of a deadline thrown in. The goal is to pick the processthat we can least afford to delay. This differs from earliestdeadline scheduling because we're not looking only at the deadline,but at the amount of time we can procrastinate (work on somethingelse) before we will have to put 100% of the CPU resource to finishingthe task. Least slack is computed as the time to the deadline minusthe amount of computation. For example, suppose that our remainingcomputation time, C, is 5 msec. and the deadline, D, is 20 msec. fromnow. The slack time is D - C, or 15 msec. The schedulerwill compare this slack time with the slack times of other processesin the system and run the one with the lowest slack time.

The effect of least slack scheduling is significantly differentfrom that of earliest deadline scheduling. With earliest deadline,we will always work on the process with the nearest deadline,delaying all the other processes. With least slack scheduling, weget a balanced result in that we attempt to keep the differencesfrom deadlines balanced among processes. If the CPU has no problemmeeting all deadlines, both scheduling policies will work satisfactorily.If there is too much of a workload and some deadlines must be missed,earliest deadline will satisfy the processes with theearliest deadlines (assuming all processes arrived at the same time)because it started working on them early. Processes with laterdeadlines will get delayed significantly. With least slack scheduling,all deadlines will be missed, but they all will be missedby roughly the same amount of time. Which is better? It depends onthe applications. The same scheduling constraint applies to LeastSlack scheduling as to Earliest Deadline First scheduling.

Rate monotonic analysis is a technique for assigning static prioritiesto periodic processes. As such, it is not a scheduler but a mechanismfor governing the behavior of a preemptive priority scheduler.A conventional priority scheduler is used with this system, wherethe highest priority ready process will always get scheduled, preempting any lower priority processes.

A scheduler that is aware of rate monotonic scheduling would be providedwith process timing parameters (period of execution)when the process is created and compute a suitable priority for theprocess.Most schedulers that support priority scheduling (e.g., Windows, Linux, Solaris, FreeBSD, NetBSD) do not perform rate monotonicanalysis but only allow fixed priorities, so it is up to the user to assignproper priority levels for all real-time processes on the system.To do this properly, the user must be aware of all the real-timeprocesses that will be running at any given time and eachprocess'frequency of execution (1/T, where T is the period).To determine whether allscheduled processes can have their real-time demands met, the system has toalso know each process' compute needs per period (C) and check that thefollowing condition holds:

Non Real Time Operating Systems

To assign a rate monotonic priority, one simply uses thefrequency information for each process.If a process is an aperiodicprocess, the worst-case (fastest) frequency should be used. Thehighest frequency (smallest period) process gets the highest priorityand successively lower frequency processes get lower priorities.

Scheduling is performed by a simple priority scheduler. At eachquantum, the highest priority ready process gets to run. Processesat the same priority level run round-robin.

Here is an example of ratemonotonic priority assignment. Supposewe have the following processes:

A runs every 50 msec for 20 msec
B runs every 50 msec for 10 msec
C runs every 30 msec for 10 msec

Real Time Operating System Rtos

Rate-monotonic assignment requires that the highest frequencyprocess(es) (B and C) get the highest priority and A, having thelowest frequency of execution, gets a lower priority. If we do notfollow the rules and give A the highest priority, B the next highest,and C the lowest, the CPU will run processes in the following order:

This does not give us the desired performance because, while processesA and B get scheduled acceptably, process C is late the second timeit is scheduled and misses an entire period! Now let us reverse thepriorities as ratemonotonic assignment would dictate:

The scheduler can now satisfactorily meet the real-time requirements these tasks.Rate monotonic priority assignment is guaranteed to be optimal. If processescannot be scheduled using rate monotonic assignment, the processes cannot beproperly scheduled with any other static priority assignment.

Real-time Operating System

  • Real-Time System Scheduling, Audsley, N and Burns, A.,Department of Computer Science, University of York, UK, © 1990
  • Introduction to Rate Monotonic Scheduling, by David Steward and Michael Barr, Netrino, November 8, 2007.
  • Rate-monotonic scheduling, Wikipedia
  • Schedulability constraints for Earliest Deadline First and Rate Monotonic scheduling are from:Lin and Layland, Scheduling Algorithm for Multiprogrammability in Hard Real Time Environments,Journal of the ACM, 20(1)-46-61, January 1973.