Advanced OS

Table of Contents

Managing physical memory

Basic data structures

Physical memory – DRAM (Dynamic random access memory)

DRAM layout

Managing physical memory on Linux

Allocating memory

Memory allocation overview

Memblock allocator

Implementation:

Buddy/zone allocator

Implementation:

Buddy allocator schema

Fragmentation

External fragmentation:

Internal fragmentation

Memory errors in frame allocation

Diagram of memory allocation errors

Sanity checks done by Linux (CONFIG_DEBUG_PAGEALLOC macro):

Object-level sanitizers: kmemcheck (uninitialized reads), kmemleak (memory leaks), kasan (out-of-bounds and use-after-free)