Programming with Elijah

Programming with Elijah

Allocator Designs

This post explains how to implement heap allocators from scratch. It presents and discusses different allocator designs, including bump allocation, linked list allocation, and fixed-size block allocation. For each of the three designs, we will create a basic implementation that can be used for our kernel.

This blog is openly developed on GitHub. If you have any problems or questions, please open an issue there. You can also leave comments at the bottom. The complete source code for this post can be found in the post-11 branch.

Table of Contents

πŸ”—Introduction

πŸ”—Design Goals

πŸ”—Bump Allocator

πŸ”—Idea

πŸ”—Implementation

πŸ”—GlobalAlloc and Mutability

πŸ”—A Locked Wrapper Type

πŸ”—Implementation for Locked<BumpAllocator>

πŸ”—Address Alignment

πŸ”—Discussion

πŸ”—The Drawback of a Bump Allocator

πŸ”—Summary

πŸ”—What's next?

With this post, we conclude our memory management implementation for now. Next, we will start exploring multitasking, starting with threads. In subsequent post we will then explore multiprocessing, processes, and cooperative multitasking in the form of async/await.



Comments

OC