Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Storage management in the operating system partition storage management (1) – Nuggets (juejin. Cn)

Dynamic partitioning

Textbook definition

The dynamic partitioning method does not create partitions before the execution of job scheduling. Partitions are created during the processing of jobs, and their size can change with the memory requirements of jobs or processes.

Classroom Examples (Thinking in images)

Since fixed partition is a waste of space, this time we will dynamically partition and give you as much as you need. Here we can think about this dynamic partitioning method using some of the screens used in restaurants to divide boxes.

Dynamic partitioning features

Dynamic partitioning is characterized by the creation of partitions on the move: they are allocated as the program initially requests them when it is loaded, or they are allocated or resized by system calls during their execution. Compared with fixed partition, it has the advantage that there is no internal fragment. But it did introduce a different kind of shard, the outer shard.

Here means that every time when using dynamic partitioning, each job into the partition will leave a little space can’t use, when dynamic partition continually, work in and out, the fragments will gradually increase (because pieces and have not been able to integrate into a whole large gap between partitions, even in adjacent position), at the end of the program a job cannot be loaded.

Partition allocation for dynamic partitioning is to find a free partition larger than or equal to the size required by the program. If it is larger than the required size, the partition is split into two partitions, one of which is the required size and marked “occupied”, and the other is the remaining size and marked “idle”. The order of partition allocation is usually from low memory to high memory. One of the problems with dynamic partition release is merging adjacent free partitions into one large free partition.