Textbook Source Code section
Chapter 8th Partner Systems- boundary labeling Method
--"Data structure"-Min. 聯繫 version
Source code Use instructions link??? data Structure-C language edition (Min, 聯繫 version) textbook source + problem sets analysis using instructions
Textbook source Collection link??? "Data structure" textbook source code compilation
Problem sets full parse link??? analysis of the problem of the data structure problems in the compilation
Source code introduced by the file link? Status.h
relevant test data download link? Data Package
document source code and test data storage directory: Data structure \▲ textbook algorithm implementation \▲08 dynamic storage Management \02 Buddysystem
Overview
One of the most important things about Linux kernel memory management is how to avoid fragmentation when you frequently request to release memory. Linux uses a partner system to solve the problem of external fragmentation, using slab to solve internal fragmentation issues, where we discuss external fragmentation issues.
parsing
There are two ways to avoid external fragmentation: one is to use the allocation of non-contiguous memory, and the other is to use an efficient method to monitor the memory, ensuring that the kernel will not intercept a chunk of contiguous free memory when it requests a small chunk of memory, thus guaranteeing the continuity and integrity of the chunk memory. Obviously, the former can not be a common way to solve the problem, one to map the non-contiguous memory linear address space is limited, and each mapping to rewrite the kernel's page table, and then flush the TLB, which makes the allocation of the speed is greatly reduced, this is very often to apply for the memory of the kernel is obviously unbearable. So Linux uses the latter to solve the problem of external fragmentation, known as the partner system.
The purpose of the partner system is to satisfy the kernel's request for memory with the smallest memory block.
Source Code
file one? BuddySystem.h
file two? buddysystem.c
file three? buddysystem-main.c (test document)
test results show
more chapters in the Continuous update ...
8-2-Partner system-Dynamic Storage Management-8th chapter-Data structure textbook source code-Min 聯繫 version