the memory management mechanism used in the embedded system mainly has the following two kinds:
1. Virtual memory management mechanism:
There are some embedded processors that provide the MMU, with memory address mapping and addressing in the MMU, which makes memory management of the operating system more convenient. If there is an MMU, the operating system uses it to complete the conversion from the virtual address to the physical address, and all applications only need to address the data using virtual addresses. This use of virtual addresses to address the entire system of main memory and secondary storage in modern operating systems is called virtual memory. The MMU is the necessary condition for implementing virtual memory. the management of virtual memory enables the system to run applications that are larger than physical memory, or to implement the "on-demand paging" strategy, which satisfies the program's running speed and saves the physical memory space. In the Linux system, the implementation of virtual memory mechanism provides us with a typical example: under different architectures, the use of three-level or two-level page management, using the MMU to complete the conversion from virtual address to physical address. The most important benefit of memory management based on virtual memory is that the system reliability and security are improved effectively because the different processes have their own separate process space.
2, non-virtual memory management mechanism:
in the case of high real-time requirements, many embedded systems do not require a virtual memory mechanism: Because the virtual memory mechanism can lead to uncertain I/O blocking time, which makes the program run time unpredictable, which is the fatal flaw of the real-time embedded system, in addition, from the embedded processor cost considerations, Embedded microprocessors that do not assemble the MMU are mostly used. Therefore, most embedded systems use real memory management strategy. Therefore, the access to the memory is direct, its access to the address does not need to go through the MMU, but directly to the address line output, all programs access to the address is the actual physical address, and most of the embedded operating system does not protect the memory space, each process actually share a running space. Before a process executes, the system must allocate sufficient contiguous address space for it, and then load all the contiguous space in the main storage.
Therefore, the embedded system developers have to participate in the system's memory management. Starting with the build kernel, developers must tell the system how much memory the board has, and when developing an application, you must consider the allocation of memory and focus on the size of the space the application needs to run. In addition, due to the use of real memory management policy, the user program with the kernel and other user programs in an address space, the program development to ensure that the other program's address space is not violated, so that the program does not disrupt the normal operation of the system, or cause other programs to run abnormally; Developers of embedded systems should be cautious about some of the memory operations in the software. Ucos is an example of using non-virtual memory management, in Ucos, all the tasks share all the physical memory, there is no memory protection mechanism between the tasks, which can improve the corresponding time of the system, but the task memory operation is improper, can cause system crash.
The essential difference between segment storage management and page-storage management:
the logical address in page storage Management consists of a page number and an industry address, but the job still uses a sequential logical address, which can be thought of as a one-dimensional (linear) address structure. The user does not have the concept of paging, the operating system to load the job information into main memory only according to block length paging.
the logical address in the segment storage Management is composed of the segment number and the address in the segment. He supports the segmentation of the user, the logical address within each paragraph is contiguous, and the logical address between the segment and the segment is discontinuous. Therefore, the logical address in the segment storage management is actually the two-dimensional address structure.
What kinds of embedded operating system memory management, what are the characteristics of each