8-2-partner system-Dynamic Storage Management-Chapter 8th-Data Structure textbook source code-yan Weimin Wu Weimin edition, 8-2-Data Structure

Source: Internet
Author: User

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...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.