Embedded system development - operating system - archiving - why do you need an operating system

Why use an operating system? That is, what are the benefits of using an embedded operating system?

In theory, an operating system is between hardware (drivers) and software (user applications). Software developers on top of the operating system do not need to deal with hardware.
1. The operating system can reduce the difficulty of development.
Soft armor developers do not need to deal with hardware, and do not need to understand hardware. In addition, the
operating system helps us coordinate the coupling relationship between multiple programs. For example, we need to display the data received by the serial port on an LCD. The traditional method is as shown in the figure:
write picture description here
In this process, when the serial port receives the data, the LCD display program is called to display the data.
The following figure shows a method based on the operating system. In this method, both the serial port receiving data and the LCD display program think that they own the CPU, and each only performs its own relevant part of the work, and when it is displayed on the LCD screen and when it continues to receive the serial port data, the coordination work will be completed by the operating system.
write picture description here
From the above comparison, it can be seen that the operating system coordinates different functional programs so that they can work together to accomplish the same job. At the same time, the operating system isolates each functional program to reduce the degree of coupling between them. In this way, it is convenient for designers to write various functional modules, and the structure of the whole system is also clearer. This advantage of the operating system is more obvious especially when the system logic structure is complex and there are many functional modules. .

2. Increase code readability. Bring convenience to subsequent code maintenance.
Use the operating system. The code can be managed hierarchically, the driver belongs to the driver, and the application layer belongs to the application layer. And the functions in the task are very obvious. The priority of each task, the execution cycle can be expected. When the program is relatively large, the readability of the program with the operating system will be much higher than that of the streaking chip.

3. Increase code portability.
When using the operating system, the execution time of each task, the priority, and the length of the delay. That is, most of the logic aspects have been set in the operating system. And divide the things that need to be processed into multiple tasks. Each task is relatively independent. When the code needs to be transplanted, it is only necessary to transplant the operating system, and then transplant the driver to basically complete the original function. If the operating system is not used, porting a code with complex logic and timing will be a disaster.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325420268&siteId=291194637