In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "whether linux is a real-time operating system". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "whether linux is a real-time operating system" can help you solve the problem.
Linux is not a real-time operating system. Linux is a time-sharing operating system, which makes a computer serve several, dozens or even hundreds of users at the same time. The time-sharing operating system switches the system processor time and memory space to the programs of each end user in turn according to a certain time interval.
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Is linux a real-time operating system (RTOS)?
RTOS, English full name Real Time Operating System, that is, real-time operating system.
1. Real-time operating system definition
Real-time operating system (RTOS) is an operating system in which external events or data can be accepted and processed at a fast enough speed, and the results of its processing can control the production process or respond quickly to the processing system within a specified time, and control all real-time tasks to run harmoniously.
Therefore, providing timely response and high reliability is its main feature.
Real-time operating system can be divided into hard real-time and soft real-time. Hard real-time requires that the operation must be completed within a specified time, which is guaranteed when the operating system is designed.
Soft real-time can only complete the operation as quickly as possible according to the priority of the task. The operating system we usually use can become a real-time operating system after a certain change.
Real-time operating system is an operating system that guarantees to complete specific functions within a certain time limit. For example, an operating system can be designed to ensure that robots on the production line can acquire an object. In a "hard" real-time operating system, if the computation that makes the object reachable cannot be completed within the allowed time, the operating system will end up with an error.
In the "soft" real-time operating system, the production line can still work, but the output of the product will slow down because the product can not arrive within the allowable time, which makes the robot have a temporary non-production phenomenon. Some real-time operating systems are designed for specific applications, while others are generic.
Some general purpose operating systems call themselves real-time operating systems. But to some extent, most general purpose operating systems, such as Microsoft's Windows NT or IBM's OS/390, have the characteristics of real-time systems. That is to say, even if an operating system is not a strict real-time system, they can solve some real-time application problems.
two。 Characteristics of real-time operating system
1) multitasking
2) have thread priority
3) multiple interrupt levels
Small embedded operating systems often need real-time operating systems, and the kernel should meet the requirements of real-time operating systems.
3. Related concepts of real-time operating system
(1) basic concepts
Code critical section: refers to the code that is indivisible when processing. Once this part of the code starts to execute, interrupts are not allowed.
Resources: any entity occupied by the task
Shared resources: resources that can be used by more than one task
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, and each task is in the following five states: dormant state, ready state, running state, suspended state, interrupted state
Task switching: save the current state of the running task (all the contents of the CPU register) in the task's own stack area, then reload the current state of the next task to be run into the CPU register from the task's stack and start the next task
Kernel: responsible for managing tasks, allocating CPU time for each task, and responsible for communication between tasks. It is divided into non-stripping kernel and stripping kernel.
Scheduling: one of the main responsibilities of the kernel to determine which task to run. Generally based on priority scheduling method
(2) the question of priority
Task priority: static priority with unchangeable priority and dynamic priority with changeable priority
Priority inversion: priority inversion is the most common problem in real-time systems. The allocation of shared resources can cause low-priority tasks to run first and high-priority tasks to run later. The solution is to use the priority inheritance algorithm to change the task priority temporarily to contain the priority inversion.
(3) Mutual exclusion
Although the shared data area simplifies the exchange of information between tasks, it is important to ensure that each task is exclusive when dealing with shared data. The general methods to make it meet the mutually exclusive conditions are: turn off interrupt, use test and set instruction (TAS), disable task switching, and use semaphores.
Because the significance of using real-time operating system is to be able to deal with all kinds of unexpected events in time, that is, to deal with all kinds of interrupts, therefore, the most important and representative performance parameter of embedded real-time operating system should be interrupt response time. Interrupt response time is usually defined as:
Interrupt response time = interrupt delay time + time to save CPU state + execution time for the kernel's ISR to enter the function.
Interrupt delay time = MAX (maximum time of off interrupt, maximum instruction time) + time to start executing the first instruction of ISR.
Time-sharing operating system (TSOS)
TSOS, English full name Time-sharing Operating System, that is, time-sharing operating system.
An operating system that makes a computer serve several, dozens or even hundreds of users at the same time is called a time-sharing operating system. The computer is connected with many end-users, and the time-sharing operating system switches the system processor time and memory space to the programs of each end-user in turn at certain time intervals.
Because of the short time interval, each user feels as if he has a monopoly on the computer. The characteristic of time-sharing operating system is that it can effectively increase the utilization rate of resources. For example, UNIX system adopts CPU scheduling with dynamic priority, which strongly supports time-sharing operation.
The generation of time-sharing system is a new type of OS formed to meet the needs of users. There is a completely different performance difference between it and multi-channel batch processing system. The needs of users are embodied in the following aspects: the sharing host of human-computer interaction is convenient for users to get on the computer.
1. The basic idea of time-sharing system
Time slice: it divides the computer system resources (especially CPU time) into time slices. Each time period is called a time slice, and each user takes turns to use time slices.
Time-sharing technology: divide the running time of the processor into very short time slices, and distribute the processor to each online job in turn according to the time slice.
Time-sharing operating system: an online, multi-user interactive operating system. Time slice rotation is generally used to make a computer serve multiple terminals. Fast enough response time can be guaranteed for each user, and interactive conversation ability can be provided.
Design goal: respond to users' requests in a timely manner, and improve the utilization of system resources as much as possible.
It is suitable for situations that require man-machine conversation, such as office automation, teaching and transaction processing.
two。 Mode of work
A host is connected to several terminals; each terminal has a user in use; a command request is made to the system interactively; the system accepts commands from each user; and the time slice rotation method is used to process the service request; and the result is displayed to the user in an interactive way; the user issues the next command according to the result of the previous step.
The key problem in the implementation of time-sharing system: timely reception. Deal with it in time.
3. Features
Interactivity: the user has a man-machine dialogue with the system.
Multipath: multiple users use the same CPU on their respective terminals at the same time.
Independence: users can operate independently, do not interfere with each other, and do not confuse each other.
Timeliness: users can get timely answers from the system in a short period of time.
The factors that affect the response time: the number of terminals, the size of time slices, the amount of information exchange, the speed of information exchange.
Difference
RTOS and TSOS have their own characteristics. RTOS is generally used in relatively low-speed MCU, such as motion control, keystroke input and other systems that require real-time processing, generally require ms-level, or even us-level response.
Time-sharing: now popular PC, servers all adopt this operation mode, that is, the operation of CPU is divided into several time slices to deal with different operation requests.
Real-time: generally used on single-chip microcomputer, such as elevator up and down control, for buttons and other action requirements for real-time processing.
Last
Through the above analysis, we can make it clear that linux is a time-sharing system, but it can be changed to real-time systems such as: UCOS is a real-time system modified by linux. As for their differences, you can quote similar answers in Baidu:
Time-sharing system is a system that can serve two or more accounts at the same time!
This is the end of the introduction to "whether linux is a real-time operating system". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.