"Programmer's Self-cultivation" reading notes

                                        "Programmer's Self-cultivation" reading notes

The overall purpose of the process is to hope that each process can logically monopolize the resources of the computer. The multitasking function supported by the operating system ensures that each process can share the CPU resources well, and the IO abstraction model of the operating system realizes the device. sharing, the only remaining problem is memory allocation. When we wrote small programs, we have experienced the problem that the memory space applied by the program is too large, causing the program to crash or even the computer to crash. For example, when using high-dimensional arrays, when the number of dimensions is too high and the length of each dimension is too large will cause the program to crash. In early computers, programs run directly on physical memory, that is to say, the addresses accessed by programs during runtime are all physical addresses. In the face of multiprogramming, time-sharing systems and multitasking, the utilization of CPU will be reduced. Relatively high, an obvious problem is how to allocate limited physical addresses to multiple programs.

There are many problems with direct allocation. If the address space is not isolated, some programs may tamper with the memory of other programs, which will cause other programs to crash. This is intolerable for users who need a secure and stable computing environment. We hope that when a program crashes, it does not affect other tasks. And this will lead to very low memory usage efficiency. Since there is no memory management mechanism, the monitoring program will load the entire program into the memory and execute it, which is very wasteful. Moreover, when the program is written, the free area of ​​the memory is not fixed, and the program has many address jumps that are fixed, which creates a contradiction.

There are many ways to solve these problems. The most effective one is to set up the middle layer, that is, to use indirect address access. Through a certain correspondence, the address given by the program is regarded as a virtual address, and then we only need to manage this write. The corresponding process of virtual address and physical address can effectively manage memory.

Guess you like

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