【000 Operating System】The difference between real-time operating system and time-sharing operating system

1. Hard real-time and soft real-time

Real-time: The clock signal can be accurately timed, and clocks everywhere can be consistent.

Hard real-time: A hard real-time system has a rigid, unchangeable time limit that does not allow any error beyond the time limit. Timeout errors can cause damage or even cause the system to fail, or cause the system not to achieve its intended goals.

Soft real-time: A soft real-time system is flexible and can tolerate occasional timeout errors. The consequences of the failure are not serious, such as only slightly reducing the throughput of the system in the network.

Difference: The most critical difference between hard real-time and soft real-time is the degree of real-time guarantee. Hard real-time systems can provide strict real-time guarantees, while soft real-time systems can only provide statistical real-time performance.

For example, some applications require the system to ensure that a certain action is completed within the specified time in 95% of the cases, but not necessarily 100%. In many cases, such a "soft" correct rate can already reach the level expected by users.

Real-time: hard real-time and soft real-time_The difference between hard real-time and soft real-time_Quanbao's blog-CSDN blog


2. The difference between real-time operating system and time-sharing operating system

The main difference between them lies in how to manage and schedule tasks:

Real-time operating system: An operating system designed to meet real-time requirements. It can ensure that the task is responded and completed within the stipulated time, so in the real-time operating system, the processing time of the task is very critical. In a real-time operating system, tasks are divided into two types: hard real-time and soft real-time. Hard real-time tasks must be completed within a fixed time, while soft real-time tasks have a certain tolerance, but must be completed within the allowed time range.

Time-sharing operating system: It is an operating system based on the time slice rotation scheduling algorithm. It divides time into several time slices, and each time slice is assigned to a task, and the task runs within that time slice. When the time slice runs out, the operating system suspends the task and then allocates the CPU to the next task, and so on. In a time-sharing operating system, each task has the same time slice, so the processing time of the task is not very critical.

Difference: Compared with general operating systems, the biggest feature of real-time operating systems is "real-time". If there is a task that needs to be executed, the real-time operating system will execute the task immediately (in a short period of time) without a long wait. delay. This feature ensures the timely execution of each task. Linux, on the other hand, processes tasks as soon as possible while ensuring system performance and user experience .


3. Why can't Linux do real-time and FreeRTOS can

The real-time performance of FreeRTOS depends on its carefully designed scheduling algorithm, which is based on a priority preemptive mechanism to ensure that high-priority tasks can be executed first under any circumstances, thus ensuring real-time performance.

The Linux scheduling algorithm is based on the time slice rotation mechanism , which means that each task will be executed in turn according to a certain time slice, so it cannot ensure that high-priority tasks can be executed first under any circumstances.

Guess you like

Origin blog.csdn.net/qq_41709234/article/details/131977849