Author

B08 — Memory Layout of Kernel Space and User Space: vmalloc vs kmalloc

dean
B08 — Memory Layout of Kernel Space and User Space: vmalloc vs kmalloc Key Insight: The division of virtual address space is one of the most important OS design decisions. x86-64 Virtual Address Space Layout Modern Linux uses a 48-bit virtual address space. User space and kernel space each have separate regions: x86-64 虚拟地址空间布局: 0x0000000000000000... » read more

[Writing an OS Kernel from Scratch] 337 – DRAM Training: From Principles to Debugging

dean
title: [Writing an OS Kernel from Scratch] 337 – DRAM Training: From Principles to Debugging category: os tag: [dram, ddr, embedded, signal-integrity] source: https://github.com/golang12306/os-kernel-from-scratch [Writing an OS Kernel from Scratch] 337 – DRAM Training: From Principles to Debugging 1. What Is DRAM Training? DRAM Training is the process where the DDR controller automatically adjusts signal... » read more

H01 — How Memory Modules Plug Into the Motherboard: DIMM Structure and Socket Design

dean
H01 — How Memory Modules Plug Into the Motherboard: DIMM Structure and Socket Design Key Insight: Behind every visible interface lie countless electrical conventions. DIMM Full Name and Basic Concepts DIMM = Dual Inline Memory Module. DIMM vs SIMM: SIMM(Single Inline Memory Module): - 单面引脚(只能接触一侧的触点) - 72-pin 或 30-pin(早期) - 只能提供 32-bit 或 16-bit 数据宽度... » read more

K12 — Memory Fragmentation and Compaction: Why Large Memory Allocations Fail

dean
K12 — Memory Fragmentation and Compaction: Why Large Memory Allocations Fail Key Insight: Fragmentation is the chronic disease of memory — it doesn’t hurt normally, but when it flares up, it can be fatal. What Is Memory Fragmentation Memory fragmentation refers to the presence of many “small holes” in memory that make it impossible to... » read more

A09 — Memory Barriers and Cache Coherence: Out-of-Order Access on Multi-Core

dean
A09 — Memory Barriers and Cache Coherence: Out-of-Order Access on Multi-Core Key Insight: In a multi-core CPU, the memory order you observe is not necessarily the true order. Out-of-Order Memory Access on Multi-Core CPUs Modern CPUs reorder memory access instructions for performance optimization. In multi-core programs, this reordering can cause serious problems. 内存访问乱序的例子: 线程 A:... » read more

Writing an OS Kernel from Scratch | Clocksource Framework — How Linux Picks the Best Clock Source Among TSC, HPET, and LAPIC

dean
Writing an OS Kernel from Scratch | Clocksource Framework — How Linux Picks the Best Clock Source Among TSC, HPET, and LAPIC Have you ever encountered this strange phenomenon: On a multi-core machine, calling clock_gettime(CLOCK_MONOTONIC) twice in succession actually returns time that went backwards? Or in a virtual machine, the system time suddenly “jumps” and... » read more

B11 — Modern Computer Memory Layout: Complete Virtual to Physical Address Mapping

dean
B11 — Modern Computer Memory Layout: Complete Virtual to Physical Address Mapping Key Insight: Understanding memory layout is the key to understanding system design. Evolution from Physical to Virtual Addressing Early computers (before the 80286) had no MMU. They directly used physical addresses. Later, segmentation was introduced, then paging, making memory layouts increasingly complex. 内存布局的演进:... » read more

A02 — Internal Structure of the Heap: Arena, Bin, and Chunk

dean
A02 — Internal Structure of the Heap: Arena, Bin, and Chunk Key Insight: The heap managed by malloc is a precision system of bins and chunks. Structure of malloc_chunk malloc 把内存分成 chunk(块)来管理: struct malloc_chunk { INTERNAL_SIZE_T prev_size; // 前一个 chunk 的大小(如果前一个空闲) INTERNAL_SIZE_T size; // 本 chunk 大小 + 标志位 malloc_chunk *fd; // 同 bin 的下一个... » read more

Understanding Low-Level Principles – Memory Series | S06 | How DDR5 Doubles Memory Bandwidth Compared to DDR4

dean
Understanding Low-Level Principles – Memory Series | S06 | How DDR5 Doubles Memory Bandwidth Compared to DDR4 Key Insight: Every new generation of memory standard is essentially bargaining with the laws of physics — when bandwidth is insufficient, find a new way to “squeeze” more data through. 1. The Bandwidth Improvement Formula Memory bandwidth calculation... » read more

A06 — new/delete vs malloc/free: Differences in C++ Memory Management

dean
# A06 — new/delete 和 malloc/free: C++ memory management的Difference **金句**: new 不是 malloc, delete 不是 free — 它们不只是allocate, 还有构造和析构. — ## new 和 malloc 的Essential Difference “` new 和 malloc 的区别: malloc: – C 库函数 – 只分配内存,不初始化 – 返回 void* – 失败返回 NULL new: – C++ 关键字 – 分配内存 + 调用构造函数 – 返回具体类型的指针(不需要类型转换) – 失败抛出... » read more

K11 — The Full Path of Physical Page Allocation: alloc_pages and the Buddy System

dean
K11 — The Full Path of Physical Page Allocation: alloc_pages and the Buddy System Key Insight: Every call to alloc_pages embarks on a complete journey from request to physical page frame. The alloc_pages Function Signature alloc_pages is the core function for allocating physical pages in Linux: struct page *alloc_pages(gfp_t gfp_mask, unsigned int order); Parameters: -... » read more

[Writing an OS Kernel from Scratch] 335 – ARM Architecture Boot: From Power-On to Kernel

dean
title: [Writing an OS Kernel from Scratch] 335 – ARM Architecture Boot: From Power-On to Kernel category: os tag: [arm, boot, embedded, u-boot] source: https://github.com/golang12306/os-kernel-from-scratch [Writing an OS Kernel from Scratch] 335 – ARM Architecture Boot: From Power-On to Kernel 1. ARM Boot Sequence Overview Embedded device boot is a layered relay race. To understand... » read more

Writing an OS Kernel from Scratch | 347: Display — From Framebuffer to GPU

dean
Writing an OS Kernel from Scratch | 347: Display — From Framebuffer to GPU Abstract: The display is the most intuitive output device of a computer, but the timing, resolution, framebuffer, and GPU rendering pipeline behind it are rarely studied in depth. This article starts from CRT timing principles, explains the DRM/KMS architecture, modetest/xrandr commands,... » read more