Linux Process Memory Management

We’ve all learned that a process’s memory consists of the heap and the stack. But this model is still too abstract — it conceals many operating system details. So here’s a brief rundown of process memory management. Heap Growth libc provides the malloc function for heap memory allocation. Under the hood, it relies on the brk system call. From the kernel’s perspective, the heap is a simple structure. It consists of a fixed heap base (the end symbol) and a movable heap top (called the program break)....

May 17, 2025 · 12 min · 2543 words · Wokron

A Discussion on Environment Variables

By “environment variables,” I mean more than just shell variables. I’m referring to the variables that each process possesses and can access through system APIs. Of course, shells typically provide ways to manipulate environment variables, and we often manage them through a shell. But shell variables and environment variables are not exactly the same thing, and the two concepts can easily be confused. Let’s try to untangle them here. 1. Environment Variables From a program’s perspective, environment variables are simple....

November 2, 2024 · 4 min · 815 words · Wokron

A Brief Discussion on Fonts

A while back, I found that Matplotlib couldn’t display Chinese characters properly. While solving the problem, I learned a fair bit about how font rendering works. Here are my notes. 1. Encoding and Fonts We know that to store characters in a computer, we assign a numeric code to each character. This artificial convention is called character encoding. Common encodings include ASCII, GBK, Unicode, and so on. Character encoding is the data representation of characters....

May 5, 2024 · 7 min · 1340 words · Wokron