Author

B10 — Why fork is Fast: The Copy-On-Write Mechanism

dean
B10 — Why fork is Fast: The Copy-On-Write Mechanism Key Insight: Don’t copy, just share. Until it’s actually needed. The Traditional Problem with fork: Massive Memory Copying The fork system call creates a new process. The traditional implementation copies the entire memory space of the parent process: 传统 fork 的问题: 父进程内存:假设 1GB fork() 执行时: -... » read more

Writing an OS Kernel from Scratch – Part 4: Entering Protected Mode (Detailed Segmented Memory Management)

dean
# Writing an OS Kernel from Scratch – Part 4: Entering Protected Mode (Detailed Segmented Memory Management) “Protected mode ≠ Paging! Its first line of defense is the segmentation mechanism that modern OSes ‘quietly bypass.'” In the previous few articles, we used GRUB to easily boot the kernel, output “Hello World,” and understood the Multiboot... » read more

H08 — DDR5 On-Die ECC and Sideband ECC: On-Chip Error Correction vs System ECC

dean
H08 — DDR5 On-Die ECC and Sideband ECC: On-Chip Error Correction vs System ECC Key Insight: ECC is not just a technology. It is a commitment to data reliability. ECC Types Introduced in DDR5 DDR5 has three types of ECC, working at different levels: DDR5 ECC 的三层架构: Layer 1:On-Die ECC(片内 ECC) → DRAM 颗粒内部,每颗颗粒自己纠错 →... » read more

Writing an OS Kernel from Scratch – Part 5: Enabling Paging — Building the Foundation of Virtual Memory

dean
# Writing an OS Kernel from Scratch – Part 5: Enabling Paging — Building the Foundation of Virtual Memory “Segmentation is just a transition; paging is the true moat of modern operating systems. Today, we manually enable x86 paging, giving the kernel virtual memory!” In the previous article, we deeply understood protected mode and segmented... » read more

354 | Interrupt Controller: How Hardware Interrupts the CPU

dean
354 | Interrupt Controller: How Hardware Interrupts the CPU Key Insight: You press a key, and a character appears on the screen almost simultaneously — behind this, the CPU has never been “waiting” for the keyboard. It has been running its own code the whole time, until the hardware forcibly “interrupts” it. 1. Problem: How... » read more

K04 — When Memory Is Exhausted: How the OOM Killer Chooses Its Victims

dean
K04 — When Memory Is Exhausted: How the OOM Killer Chooses Its Victims Key Insight: When memory is exhausted, the kernel needs a “referee” to decide who should leave. That is the OOM Killer. OOM Killer Trigger Conditions When system memory is critically low, Linux invokes the OOM Killer. The trigger is not “memory is... » read more

S08 — How Does an Address Travel from the CPU to a DRAM Cell

dean
S08 — How Does an Address Travel from the CPU to a DRAM Cell Key Insight: Every bit of data has its complete journey map. The Complete Path from CPU to DRAM How does an address issued by the CPU ultimately select a DRAM cell? It requires a complete address resolution process. Complete path (simplified):... » read more

K02 — Process Address Space: Virtual Address Management and VMA

dean
K02 — Process Address Space: Virtual Address Management and VMA Key Insight: Each process’s address space is an independent map. Every region on the map is described by a VMA. What is a VMA (Virtual Memory Area) VMA (Virtual Memory Area) is a Linux kernel data structure describing a contiguous region in a process’s virtual... » read more

A04 — Memory Leaks: How malloc Without free Causes Leaks

dean
A04 — Memory Leaks: How malloc Without free Causes Leaks Key Insight: After the program ends, the system reclaims the memory. But during execution, leaked memory is truly leaked. What is a Memory Leak A memory leak occurs when a program dynamically allocates memory and fails to free it, making that memory permanently unavailable for... » read more

B01 — BIOS’s First Map for the OS: The e820 Memory Map

dean
B01 — BIOS’s First Map for the OS: The e820 Memory Map Key Insight: When the computer starts, the first problem the OS must solve is: how much memory is there and where is it? The OS’s First Question After Power-On After power-on, BIOS (UEFI) first completes hardware initialization. Then the OS starts booting. The... » read more

331 – Android Bootloader: From Chip Power-On to Kernel Loading

dean
331 – Android Bootloader: From Chip Power-On to Kernel Loading Series Navigation: 330-Boot Overview | 332-init Process | 333-Zygote In the previous article, we outlined the complete Android boot chain. This article focuses on the first software stage — the Bootloader. The Bootloader is the first software code to run after hardware powers on (hard-coded... » read more

Writing an OS Kernel from Scratch — Part 16: VMA and Process Exit — Safely Reclaiming Every Byte of Memory

dean
从零写 OS kernel-Part 16: VMA 与process退出 — 安全reclaim每一片内存 “Allocating memory is just the beginning — safe release is the true endpoint. Today, we implement Virtual Memory Area (VMA) management, ensuring every resource is reclaimed without leaks when a process exits!” 在前几篇中, 我们Implementation了 Buddy 系统, Slab allocate器, 用户态 malloc, 但process的virtual address空间仍是一团乱麻: 无法跟踪哪些Region已allocate process退出时, 物理页, file descriptor,... » read more

Writing an OS Kernel from Scratch | NIC — From PHY to Socket

dean
Writing an OS Kernel from Scratch | NIC — From PHY to Socket Have you ever thought about this process: You type in a URL, how does the data packet get sent from your computer to the server? The CPU hands the data to the network card, and the network card sends the electrical signal... » read more