Real-time Operating system

Source: Internet
Author: User

Real-time Operating system (RTOS) refers to when external events or data generated, can be accepted and fast enough to process, the results of its processing can be within the specified time to control the production process or to respond quickly to the processing system, scheduling all available resources to complete real-time tasks, and control all real-time tasks in a coordinated and consistent running operating system. Providing timely response and high reliability are its main features. [1]
Chinese name
Real-time Operating system
Foreign names
Real Time Operating System
Common systems
Industry applications
Industrial automation, Military, power, new energy
Real-time response, stable and reliable
    1. 1 Definitions
    2. 2 Real-time tasks
    3. 3 Characteristics
    1. 4 Comparison
    2. 5 Related Concepts
    3. ? Basic Concepts
    1. ? Priority Issues
    2. ? Mutex
DefinedEditA real-time operating system is an operating system that ensures that certain functions are completed within a certain time limit. Real-time operating system has hard real-time and soft real-time points, solid requirements in the time required to complete the operation, which is guaranteed during the design of the operating system, soft real-time as long as the task priority, as soon as possible to complete the operation. The operating system we typically use can become a real-time operating system after a certain change. For example, an operating system can be designed to ensure that a robot on a production line can acquire an object. In a "hard" real-time operating system, the operating system will end up with an error if it is not possible to complete the calculation of the object within the allowed time. In the "soft" real-time operating system, the production line can still continue to work, but the output of the product can not be reached within the allowable time to slow down, which makes the robot has a short period of non-production phenomenon. Some real-time operating systems are designed for specific applications and others are generic. Some general purpose operating systems call themselves a real-time operating system. But to some extent, most of the general purpose operating systems, such as Microsoft's Windows NT or IBM's os/390, have real-time system features. This means that even if an operating system is not a strict real-time system, they can solve some real-time application problems. In general, the real-time operating system (RTOS) requires:
    • Multi-tasking
    • Process lines that can be differentiated by priority
    • The amount of an interrupt level
Embedded small operating systems that are mounted as part of a micro-device often require a real-time operating system. Some core issues can be considered to meet the needs of the real-time operating system. However, because other components like device drivers are often required by special methods, a real-time operating system is usually larger than the core. [2] real-time tasksEditThere are certain real-time tasks in real-time systems, which are usually related to some external devices, can react to or control the corresponding external devices, and thus have some degree of urgency. Real-time tasks can be categorized from different perspectives. 1, according to the task when the implementation of the periodic change to divide: A, periodic real-time task external equipment periodically sends an excitation signal to the computer, it is required to cycle through the specified cycle of execution, in order to periodically control an external device. b, the non-cyclical real-time task external equipment issued by the excitation signal does not have a significant periodicity, but must be linked to a cutoff time. It can also be divided into two parts: the start deadline (the task must start at a certain time) and the completion deadline (the task must be completed before a certain time). 2, according to the requirements of the time to divide: A, hard real-time task B, soft real-time task [1] CharacteristicsEdit1) The timing accuracy of the high-precision timing system is an important factor affecting the real-time performance. In real-time applications, it is often necessary to accurately determine the real-time operation of a device or perform a task, or to accurately calculate a time function. These depend not only on the clock accuracy provided by some hardware, but also on the high-precision timing functions implemented by the real-time operating system. 2) Multi-level interrupt mechanism a real-time application system usually needs to deal with a variety of external information or events, but the urgency of processing is prioritized. Some must respond immediately, while others may be deferred. Therefore, it is necessary to establish a multi-level interrupt nesting processing mechanism to ensure the timely response and processing of high-urgency real-time events. 3) Real-time scheduling system not only to timely respond to real-time event interruption, but also to timely scheduling running real-time tasks. However, the processor scheduling can not be carried out arbitrarily, because it involves switching between two processes, only in ensuring "safe switching" point in time, the real-time scheduling mechanism includes two aspects, one is the scheduling strategy and algorithms to ensure priority scheduling real-time tasks, the second is to establish more "safe switching" point of time, Ensure timely scheduling of real-time tasks. Real-time Operating system features IEEE real-time UNIX sub-Committee believes that real-time operating systems should have the following: 1, asynchronous event response 2, switching time and interrupt delay time to determine 3, priority interrupt and scheduling 4, preemptive scheduling comparisonEditComparison of real-time systems with CTSS features (1) multiplexing. The real-time information processing system is as multi-way as the timeshare system. The system is based on the principle of time-sharing for multiple end-users, while the multi-route control system is mainly used to collect multi-channel information and control multiple objects or actuators. (2) independence. The real-time information processing system is as independent as the timeshare system. Each end user in the service request to the CTSS, is independent of each other's operation, non-interference, but in the real-time control system information collection and control of the object, but also do not interfere with each other. (3) timeliness. Real-time information system is similar to the requirement of CTSS, which is determined by the waiting time that can be accepted by people, and the timeliness of real-time control system is determined by the start deadline or completion deadline required by the control object, which is usually seconds, hundred milliseconds until the millisecond level, and even some less than 100 microseconds. (4) Interactivity. The real-time information processing system is interactive, but the human interaction with the system is limited to accessing some specific specialized service programs in the system. It is not the same as the time-sharing system to provide end users with data processing services, resource sharing and other services. (5) reliability. CTSS requires a reliable system, compared to a real-time system that requires a highly reliable system. Because any mistake can lead to huge economic losses and even unpredictable catastrophic consequences. Therefore, in the real-time system, multilevel fault-tolerant measures are adopted to ensure the security of the system and the security of the data. [1] Related conceptsEditBasic concept Code critical section: refers to the process of an inseparable code. Once this part of the code starts execution, interrupts are not allowed; resources: Any entity that is occupied by the task; shared resources: resources that can be used by more than one task; a task: Also known as a thread, is a simple program. Each task is given a certain priority, with its own set of CPU registers and its own stack space. Typically, each task is an infinite loop, each of which is in the following five states: Dormant, ready, run, suspended, interrupted; task switching: Saves the current state of the running task (the entire contents of the CPU register) in the task's own stack, It then re-loads the current state of the next running task from the stack of the task into the CPU register and starts the next task; kernel: Responsible for managing individual tasks, allocating CPU time for each task, and responsible for communication between tasks. It is divided into an inalienable kernel and a stripped kernel; Dispatch: One of the main functions of the kernel determines which task is to run. General priority-based scheduling method; Priority problem task priority: The priority is divided into the static priority and the priority can change the dynamic priority; Priority inversion: priority reversal is the most common problem in real-time systems. The allocation of shared resources can cause tasks with low priority to run first, and then to run after high-priority tasks. The workaround is to use the priority inheritance algorithm to temporarily change the priority of the task to curb the priority reversal. Mutex Although shared data areas simplify the exchange of information between tasks, it is important to ensure that each task is exclusive when it processes shared shared data. The general method that satisfies the mutex condition is: off interrupt, using test-and-set command (TAS), disable task switching, and use semaphore. Because the use of real-time operating system is to be able to deal with a variety of sudden events in a timely manner, that is, to deal with various interruptions, so the measurement of embedded real-time operating system of the main and most representative performance parameters should undoubtedly be interrupted response time. Interrupt response time is typically defined as interrupt response time = Interrupt delay time + time to save CPU State + when the ISR of the kernel enters the function execution time. Interrupt delay Time =max (the maximum time to shut down, maximum instruction time) + the time to start executing the first instruction of the ISR. Maximum interrupt Time: When the RTOs is running in a nuclear state or performing some system calls, it is not interrupted by an external interrupt. The maximum time required for this process to respond to an external interrupt request is only when the RTOs is back in the user state. Task switching time: When a task exits the runtime for some reason, the RTOs saves its run-site information, inserts the appropriate queue, and then selects a task to run according to a certain scheduling algorithm, which is called the task switching time. Of these items, the maximum interrupt time and task switching time are evaluated in an RTOS real-timeThe two most important technical indicators of sex.

Real-time operating system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.