H03 — CL-tRCD-tRP-tRAS: How Memory Timings Affect Actual Latency

dean
H03 — CL-tRCD-tRP-tRAS: How Memory Timings Affect Actual Latency Key Insight: Choosing memory only by rated frequency is like buying a car only by top speed. You’ll miss a lot. What Are Memory Timings Memory timings are parameters describing delays between memory commands. They collectively determine how fast memory operations are. DDR4 主要时序参数(以 DDR4-3200 CL22... » read more

Writing an OS Kernel from Scratch – Part 30: Window Manager Mouse Support — Implementing Click, Drag, and Window Operations

dean
# Writing an OS Kernel from Scratch – Part 30: Window Manager Mouse Support — Implementing Click, Drag, and Window Operations “The keyboard is efficient, but the mouse is intuitive. Today, we integrate mouse support into the window manager, achieving true graphical interaction!” In the previous article, we successfully implemented the PS/2 mouse driver and... » read more

A07 — Memory Pool: Pre-allocate, On-demand Allocation, Avoiding Fragmentation

dean
A07 — Memory Pool: Pre-allocate, On-demand Allocation, Avoiding Fragmentation Key Insight: In scenarios with frequent allocation/deallocation, pre-allocating a pool is 100x faster than asking the system each time. What is a Memory Pool A Memory Pool pre-allocates a large block of memory and allocates from it on demand. Compared to calling malloc each time, memory... » read more

332 – Android init Process: The First Userspace Process

dean
332 – Android init Process: The First Userspace Process Series Navigation: 330-Boot Overview | 331-Bootloader | 333-Zygote Two articles ago, we covered how the Bootloader loads the kernel. Last time, we covered how the kernel decompresses, initializes hardware, and jumps to execute userspace code. Now we arrive at a pivotal role in the Android boot... » read more

232 iptables: Deep Analysis of Rule Tables and Chains

dean
232 iptables: Deep Analysis of Rule Tables and Chains Preface In the previous article, we gained a deep understanding of Netfilter’s HOOK mechanism — that’s the underlying infrastructure of the entire framework. If we think of Netfilter as the ramp system of a highway, then iptables is the rulebook at the toll booths on those... » read more

356 | System Calls: How User Mode Triggers Kernel Code

dean
356 | System Calls: How User Mode Triggers Kernel Code Key Insight: User programs can never directly read or write hardware. Even just printing a character requires asking the kernel to do it on their behalf. System calls are the only gateway for this “proxy” service. 1. Problem: What If a User-Mode Program Wants to... » read more

Writing an OS Kernel from Scratch | Windows GPT+UEFI Boot: ESP Partition, NVRAM Boot Entries, and Secure Boot — Complete Analysis

dean
Writing an OS Kernel from Scratch | Windows GPT+UEFI Boot: ESP Partition, NVRAM Boot Entries, and Secure Boot — Complete Analysis The previous chapter covered the Windows boot chain in MBR+BIOS mode. The System Reserved partition was the core anchor of the entire chain — BOOTMGR and BCD both resided in that 100MB FAT32 partition,... » read more

05: Memory Management – User Mode: From brk to malloc — Deep Dive into User-Space Memory Allocators

dean
# 05: Memory Management – User Mode: From brk to malloc — Deep Dive into User-Space Memory Allocators “When a user program calls malloc, how do the kernel and libc work together? This article delves into the brk/mmap system calls, the dlmalloc algorithm, and compares glibc’s implementation details, building an efficient, low-fragmentation user-space memory allocator.”... » read more

358 | Timer: HPET and Clock Interrupts

dean
358 | Timer: HPET and Clock Interrupts Key Insight: The operating system’s sense of time doesn’t come from “watching a clock” — it’s “punched out” by interrupts. Each clock tick tells the kernel that another jiffy has passed — and then it decides who gets to run next. 1. Three Clock Hardware Components The x86... » read more

S01 — DRAM: How One Capacitor and One Transistor Store One Bit

dean
S01 — DRAM: How One Capacitor and One Transistor Store One Bit Key Insight: Behind complex systems, there are often just a few simple physical principles at work. Understanding DRAM starts with the most fundamental Cell. 1. Physical Structure of a DRAM Cell 1.1 What Is DRAM DRAM (Dynamic Random Access Memory) is the main... » read more

B09 — What Happens When Memory Runs Low: kswapd and Page Frame Reclaim

dean
B09 — What Happens When Memory Runs Low: kswapd and Page Frame Reclaim Key Insight: When memory runs tight, the system quietly moves infrequently used data to disk. This is swapping. Sources of Memory Pressure Linux always starts tidying up when memory approaches full. It swaps out infrequently used pages to disk, making room for... » read more

333 – Android Zygote: The Incubator for All App Processes

dean
333 – Android Zygote: The Incubator for All App Processes Series Navigation: 330-Boot Overview | 331-Bootloader | 332-init Process In the previous article, we covered the init process — the first userspace process, responsible for parsing configuration, mounting filesystems, managing properties, and starting key services. The most important of these services is Zygote. Zygote is... » read more

K08 — Inter-Process Shared Memory: shm and mmap(MAP_SHARED)

dean
K08 — Inter-Process Shared Memory: shm and mmap(MAP_SHARED) Key Insight: The fastest inter-process communication is no communication at all — directly share the same block of memory. Three Ways to Share Memory Between Processes Linux supports three mechanisms for inter-process shared memory: 1. System V Shared Memory (shmget/shmat) - Long history, pre-POSIX API - Managed... » read more

B06 — The Manager of Physical Memory: The Buddy System

dean
B06 — The Manager of Physical Memory: The Buddy System Key Insight: Grouping memory into “buddies” makes both allocation and reclamation efficient. Why Do We Need the Buddy System The OS needs to manage physical memory allocation and reclamation. The simplest approach is bitmap management, but it is inefficient for allocating large blocks. 位图管理的问题: 假设用... » read more