[Transfer] The difference between the statue of the status of the operating system and the non-real-time operating system

Original blog address: http://www.voidcn.com/article/p-eclzjybw-bpr.html

For real-time operating systems (RTOS) and non-real-time operating systems, you How many can be listed separately?
Real-time operating system: uCOS/VxWorks/RTLinux
Non-real-time operating system: Linux/Windows/OSX
I can only list so many.
The point is not here, the point is the difference between them, as shown in the figure below:

On the right side of the figure above The task priority is higher than the task on the left. Looking at the real-time operating system first, when the higher priority task 2 is ready, even if task 1 is running, it must immediately hand over the right to use the CPU, just like interrupts. Execute task 2 first, and wait until task 2 finishes or actively suspends (sleep) to give up the CPU, then task 1 can continue to run.

uCOS is such a real-time operating system, which is a preemptive kernel. I have argued with many colleagues that uCOS high-priority tasks are ready and low-priority tasks are executing when there is no sleep, whether high-priority tasks can interrupt low-priority tasks and be executed immediately. Unfortunately, many people still insist on it. It takes sleep to switch tasks. Every time I have no choice but to use experiments to prove something that shouldn’t be argued.

Let’s take a look at our Linux/Windows/OSX operating systems based on time slice rotation when they encounter this kind of problem. Undoubtedly, they are all non-real-time operating systems. The CPU is It is not preemptible. As you can see from the above figure, even if the high-priority task is ready, the low-priority task cannot be interrupted immediately and executed. It must wait until the low-priority task is actively suspended (sleep) or the time slice ends. Get executed. Therefore, we often encounter the problem that the application does not respond when using the PC. That is, hardware resources are occupied by other tasks, and this task cannot be executed immediately.

We usually use non-real-time operating systems for entertainment and office, so when should we use real-time operating systems? Imagine that if a missile is launched to perform an attitude adjustment task, there are other insignificant tasks in execution at this time. If it is a non-real-time operating system, you may wait for a while and then a window will pop up to tell you that the application is not responding ( If it has a window to bounce), then when the pop-up window comes out, all the missiles will be shot into outer space! There is no doubt that such high-priority tasks cannot wait a moment for the equipment to have a real-time operating system, if you don’t want your missiles to be shot into outer space.

Leave a Comment

Your email address will not be published.