A high-level program language code must be compiled , link , Load to enter memory ,
Create process at program runtime
link : Link the compiled target module into an executable program . There are static links and dynamic links .
Static link : Before the program runs , Link the target module into a complete load module
Two tasks to be done :1. Modify logical address
2. Transform external call symbols
Advantages and disadvantages
advantage : The program runs faster
shortcoming : When the program file is large , It takes up a lot of internal and external storage space , High storage overhead . Program development is not flexible enough , convenient . Modifying the first mock exam will lead to a relink to the entire program .
dynamic link : Postpone links to some target modules until the program runs ( When functions in these modules are called to execute ) Only then .
Advantages and disadvantages
advantage : Save internal and external storage space , It is convenient for program development
shortcoming : The program runs slower
load : Memory needs to be allocated for the process and the required data , Load into memory .
absolute loading : The object code that generates the physical address at compile time , When loading, the program and data are loaded into memory according to the physical address of the loading module
Relocatable loading ( Static relocation ): Relocatable code that generates logical addresses at compile time , When loading, modify the instruction and data address in the object code
In dynamic operation ( Dynamic relocation ): Address mapping is deferred until the process is executed
Memory space allocation : Allocate memory space for processes , There are continuous distribution and discrete distribution
Continuous distribution : Single continuous distribution
Fixed partition allocation
Dynamic partition allocation
Single continuous distribution : Memory is divided into system areas , User area . For single user , Single task operating system
Fixed partition allocation : The user memory space is divided into several fixed size regions
There are two cases of equal size and unequal size between partitions
data structure : Section number , Partition size , Partition start address , Partition status
Dynamic partition allocation : The system initially has only one free area . When a process requests space , According to the size of space needed by the process, the system divides a free area to the process .
When running for a period of time , Because some processes will be released , So there are discontinuous free areas in memory . So when the process requests memory again , The system finds a suitable size of free area from all the idle areas for allocation . The size and number of partitions in the system vary , The size and number of free areas also vary .
The system needs to establish and maintain records of idle partitions , It is represented by free partition and free partition chain
Free partition table
data structure : Section number , Partition size , Partition start address
Idle partition chain
data structure : Free partition size , Starting address of free partition , Pointer to the previous free partition , Pointer to the next free partition
Dynamic partition allocation algorithm :
First fit algorithm : The first adaptation algorithm requires that the idle partition chain be linked in the order of increasing address . During memory allocation , Search in sequence from the beginning of the chain , Until we find one
Until there are free partitions that can meet the process size requirements .
Cyclic first adaptation algorithm : It is also linked in the order of increasing address . When allocating memory space for a process , No longer looking for the appropriate free partition from the beginning of the chain every time , It's from the top
The next free partition of the free area found the next time starts the search .
Best fit algorithm : All the free partitions are formed into a free zone chain in the order of increasing partition size . Each time the partition size is found to be close to the needs of the process, the memory space is large
Small
Discrete distribution : Paging storage management
Segmented storage management
Segmented Paged Memory Management
Paging storage management : Page table is the data structure established by the system for the process , From page table ( Logical address ) To page box ( Physical address ) Mapping of .
Segmented storage management : The address space of a process is divided into segments , The system allocates a continuous area of physical memory for each segment , Different segments can be placed in the
Different areas of physical memory .
Segmented Paged Memory Management : The logical space of user process is divided into several segments , Each segment is further divided into several pages . Processes are stored in physical memory in units of pages
discharge , The discrete pages in each segment have logical relevance .
Technology