Processes & Process Control

the process image and its address space

When a process is running, its whole world lives in memory: the machine instructions it is executing, the variables it is holding, the stack of function calls it is in the middle of, the chunks it has allocated. This complete in-memory picture of the running program is called the process image. Picture the inside of one specific running car: the engine block (the code), the fuel in the tank (the data), the seats people are sitting in right now (the stack). The image is that whole laid-out interior.

The space the image lives in is the process's address space: a range of memory addresses that belong to this one process and no other. Conventionally it is divided into segments - the text segment (the read-only machine code), the data and BSS segments (global variables, initialized and zero-filled), the heap (memory the program asks for at run time, growing upward), and the stack (function-call frames, growing downward). Crucially these are virtual addresses: each process sees its own clean, private range starting near zero, and the kernel plus the hardware quietly translate those into real physical memory. Two processes can both use address 0x1000 and never collide, because each address is private to its own image.

Why it matters: the process image is what exec() replaces wholesale when a program launches another (it throws away the old image and loads a new one), and what fork() duplicates when a process splits in two. The private address space is the wall that isolates processes: a wild pointer in one process cannot scribble on another's memory, because the address simply does not refer to the same physical bytes. Understanding the image - text, data, heap, stack - is what lets you reason about memory segments, the stack, and the heap as parts of one running whole.

A tiny C program's image might look like: text at low addresses holding the compiled code, then the data/BSS for globals, then a heap that grows up as you call malloc(), and far away near the top a stack that grows down as functions call functions. All inside one private address space the kernel built for this process.

One process's address space: text, data, heap growing up, stack growing down - all virtual and private.

The 'private' addresses are virtual, not physical. Several processes can show the identical address yet point to different real memory; the kernel and the MMU (Field for virtual memory) do the translation, which is why isolation works.

Also called
process address spacememory image行程記憶體映像