8-2-partner system-Dynamic Storage Management-Chapter 8th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 8-2-Data Structure
Textbook source code
Chapter 2 partner system-boundary Identification
-- Data Structure-yan Weimin. Wu Weimin
Source code instructions☛☛☛Data Structure-C language version (Yan Weimin, Wu Weimin version) Textbook source code + EXERCISE set parsing instructions
Textbook source code compilation Link☛☛☛Data Structure textbook source code compilation
Question set full resolution Link☛☛☛Analysis and compilation of data structure question set
File links introduced in this source code☛Status. h
Test data download link☛Data Packets
Source code and test data storage directory in the document: Data Structure \ ▲textbook Algorithm Implementation \ ▲08 Dynamic Storage Management \ 02 BuddySystem
Overview
An important task of Linux kernel memory management is to avoid fragments when memory is frequently applied for and released. Linux uses the partner system to solve external fragments and slab to solve internal fragments. Here we will discuss the problem of external fragments.
Analysis
There are two ways to avoid external fragmentation: one is to use the allocation of non-continuous memory; the other is to use an effective method to monitor memory, ensure that the kernel does not intercept a segment from the continuous idle memory when it applies for a small block of memory, thus ensuring the continuity and integrity of the large block of memory. Obviously, the former cannot be a common solution to the problem. First, the linear address space for ing non-contiguous memory is limited. Second, each ing must rewrite the page table of the kernel and then refresh the TLB, this greatly reduces the allocation speed, which is obviously intolerable for the kernel that requires frequent memory application. Therefore, Linux uses the latter to solve the problem of external fragmentation, that is, the famous partner system.
The goal of the partner system is to use the smallest memory block to satisfy the kernel's memory requests.
Source code
File 1☛BuddySystem. h
File 2☛BuddySystem. c
File 3☛BuddySystem-main.c (test documentation)
Test Result Display
Updating more chapters...