1.
2. What do memory management need to achieve?
1) Address protection: Multi-channel programs do not interfere with each other, a process can not casually access the address space of another process.
2) Address independence: The address issued by the program is independent of the physical main memory address of the specific machine.
3. Why is virtual memory presented?
In the computer, a program to run, must be loaded into the physical main memory, but the capacity of the physical main memory is very limited, so we have to load a program into main memory, each of our program size will be limited. In addition, even though the size of each program we write is less than the capacity of the physical main memory, the number of programs that can be stored in main memory is limited. This will greatly limit the development of multi-channel programming, so we invented the concept of virtual memory! Because of the virtual memory, the size of the program we write is not limited by the capacity of main memory.
4.
5. The first problem with memory management is where the operating system program itself resides in memory, or how we allocate the memory space between the operating system and the user program.
6. In the case of multi-channel programming, the program can not always load to a fixed memory address, that is, the inability to use static address translation, the program is run when the address translation, such translation is called dynamic address translation.
7. There are two types of memory management strategies in multi-channel programming: fixed and non-fixed.
8. Fixed partition multi-channel programming memory management: The memory is divided into a fixed number of areas, each region is fixed size, and the size of these partitions can be the same, or different, when the program loads, select a currently unused fixed partition of the most appropriate load. Such as:
In this mode, a new program wants to load, must wait in the queue to advance, wait until it has the opportunity to load, but also to see if there is a suitable partition suitable for it, we will inevitably let a small program occupy a large partition, after the large program and not immediately loaded. So we came up with the following fixed partitioning mode,
Give each partition a queue, and the program is sorted by size in the appropriate queue. In fact, there are shortcomings, that is, there are free partitions, but waiting for the program is not in the queue of the partition, the resources are wasted.
9. Since the address of the program loaded into the memory is not fixed, then how do we translate the address?
Physical Address = Virtual Address + The starting address of the region where the program resides. The starting address of the region where the program resides is also known as the program base.
In the case of multi-channel programming, in order to implement the program's memory protection, as long as we access the address meet the following conditions is legitimate access: The start address of the area of the program <= valid address <= program area of the start address + program length, we just set two end value: base value and limit, Can be stored in registers, respectively called the base value register and the limit register. The base value and the limit are important two parameters, only the kernel can change them, if the switch program, as long as the base value register and limit register the value of the new program can be reset.
10. Because of the advent of virtual memory, a program can generally be placed on disk, half in memory. From physical memory, the access address issued by a program is likely to be in memory, possibly on disk.
11. Fixed partition memory Management disadvantage: The program size and partition size matching is not easy to satisfy; Special cases, there is a program larger than the maximum partition, how to solve the program at run time, memory needs to increase how to handle. So we think of memory management with non-fixed partitions. The idea of memory management for non-stationary partitions is that, in addition to the space allocated to the operating system, the rest of the memory space exists as a whole.
12. The problem with the division is that the program needs more space after execution to solve it. So the actual application of the division, such as 11_12,
13. The allocation of growth space requires consideration of the fact that the spatial growth of the program typically has two sources: data and stacks. The simplest way is that data and stacks grow in one direction in their own space, with the advantage of being independent and the disadvantage being that utilization may be low. Another option is to increase the data and stack in the opposite direction.
14. Why does the exchange appear?
The operating system is hard to know how much space a program allocates? It's hard to know how many nested calls a program will make? How much data is generated? So what do we do when the program does not really find enough space? is to give the program a larger space, we pour it onto the disk, and then load it into a larger space, which is called swapping.
15. If a program is large enough to even exceed the physical memory, can it be run?
It is possible to use overlapping management methods.
16. Double Base Address
The management of idle space, two methods: bitmap representation and linked list representation. If the number of programs is small, the list is better, because the number of items in the list is small, at the same time, it has a certain degree of fault tolerance. Bitmap representation of the space cost is almost fixed, not dependent on the number of programs, but it does not have fault tolerance, from the time cost, the link table notation is higher than the bitmap notation.
Memory management of the operating system 1