Fundamentals 22 min read

Understanding the Von Neumann Architecture, Processes, and Memory Management in Linux

This article explains the Von Neumann computer architecture, the role of the operating system, process creation and control blocks, various process states, priority and nice values, as well as virtual address spaces and their relationship to physical memory, using Linux examples and diagrams.

Open Source Linux
Open Source Linux
Open Source Linux
Understanding the Von Neumann Architecture, Processes, and Memory Management in Linux

Von Neumann Architecture

Most computers follow the Von Neumann architecture, consisting of hardware components such as input units (keyboard, mouse, scanner), a CPU (arithmetic and control units), and output units (monitor, printer). In this model the memory is the only component directly accessed by both the CPU and peripherals.

Von Neumann diagram
Von Neumann diagram

Hardware components are assembled from individual parts.

Input devices: keyboard, mouse, scanner, etc.

CPU contains arithmetic logic unit and controller.

Output devices: monitor, printer, etc.

Von Neumann rules: memory is the sole shared resource; the CPU reads/writes only memory; peripherals must read/write via memory.

Note: Input devices include keyboard, network card, disk, microphone…; CPU = arithmetic + control; Output devices include monitor, network card, disk, speaker…; All devices interact with memory only; Executable programs must be loaded into memory before execution.

Operating System (OS)

Every computer system includes a basic set of programs called the operating system (OS), which provides kernel services (process, memory, file, driver management) and auxiliary programs (libraries, shells).

OS is software that manages hardware and software resources.

Reduces user cost.

Manages all hardware and provides a stable, efficient environment for users.

Acts as pure management software.

Operating system diagram
Operating system diagram

Notes: Hardware follows Von Neumann; OS does not trust any user; all hardware access must go through OS interfaces; libraries provide APIs; system calls are OS‑provided interfaces.

Process

Description – PCB

Basic concept: a process is an executing instance of a program. The kernel represents each process with a Process Control Block (PCB), called task_struct in Linux. Identifier (PID) State, exit code, signals Priority Program counter (next instruction address) Memory pointers (code, data, shared memory) Context data (registers) I/O information (devices, file list) Accounting information (CPU time, clock ticks) Other miscellaneous fields

Notes on programming constructs, CPU registers, fetch‑decode‑execute cycle, context saving, run queues, and that each running program becomes a process.

Viewing Processes

Process view 1
Process view 1
Process view 2
Process view 2
Process view 3
Process view 3

Creating Processes – fork

Syntax:

fork syntax
fork syntax

fork creates a child process; it returns 0 in the child and the child's PID in the parent.

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int g_val = 0;
int main() {
    pid_t id = fork();
    if (id < 0) {
        perror("fork");
        return 0;
    } else if (id == 0) {
        g_val = 100;
        printf("child[%d]: %d : %p
", getpid(), g_val, &g_val);
    } else {
        sleep(3);
        printf("parent[%d]: %d : %p
", getpid(), g_val, &g_val);
    }
    sleep(1);
    return 0;
}

The result shows identical virtual addresses but different values because of copy‑on‑write.

Process States

R – running or ready in the run queue.

S – sleeping (interruptible).

D – uninterruptible sleep (disk I/O).

T – stopped (SIGSTOP).

X – dead (exit state, not shown in task list).

Z – zombie (terminated but not reaped).

R state
R state
S state
S state
T state
T state
Z state
Z state

Notes: Zombies hold PCB data until the parent reaps them; orphan processes are adopted by PID 1 (systemd or init); priority (PRI) and nice (NI) values determine scheduling order.

Priority and Nice Values

Priority determines the order in which the CPU schedules processes; a lower PRI value means higher priority. The nice value (NI) is a user‑adjustable offset ranging from –20 to 19 that modifies the base priority (PRI = 80 + NI).

Commands such as ps, top, and kill can view and change these values. In top, pressing “r” allows you to set a new nice value for a running process.

Environment Variables and Command‑Line Arguments

Linux passes environment variables and command‑line arguments to a process at creation, making them accessible via the process’s memory.

Process Address Space

Layout

Address space layout
Address space layout

Address space is a virtual view of memory that exists for the lifetime of a process, independent of the physical memory layout.

What Is Address Space?

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int g_val = 0;
int main() {
    pid_t id = fork();
    if (id < 0) { perror("fork"); return 0; }
    else if (id == 0) {
        g_val = 100;
        printf("child[%d]: %d : %p
", getpid(), g_val, &g_val);
    } else {
        sleep(3);
        printf("parent[%d]: %d : %p
", getpid(), g_val, &g_val);
    }
    sleep(1);
    return 0;
}

Running the program shows identical virtual addresses for g_val in parent and child, but different values because the pages are mapped to different physical frames after copy‑on‑write.

Virtual addresses are translated to physical addresses via page tables managed by the MMU. This protects memory from accidental or malicious access, decouples memory management from process management, and gives each process a uniform view of memory.

Relationship Between Address Space and Physical Memory

Virtual‑to‑physical mapping is performed by the Memory Management Unit (MMU) using page tables.

Additional concepts: TCB (Thread Control Block), MMU, cache, DMA.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Memory ManagementlinuxforkProcess StatesVon Neumann Architecture
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.