From Static File to Living Process: The Ultimate Symphony
Executing a program involves almost every single subsystem of a computer working in lockstep across hardware, kernel, and user applications.
Watch the complete chain of events unfold from physical mouse clicks to CPU pipelines and GPU framebuffer rendering.
1–2. Source Code to Executable Binary File on Disk
Before a program runs, compilers and linkers transform human-readable source code into a structured executable binary (.exe / PE on Windows, ELF on Linux) saved to storage:
Binary Sections
.text: Machine code instructions for the CPU.
.data: Initialized global variables.
.rodata: Read-only constants and strings.
.bss: Uninitialized memory reservations.
Dormant State on Disk
Until launched, the file remains dormant on SSD or HDD blocks as static trapped electrical charges or magnetic domains—consuming zero CPU cycles or RAM.
3–4. Double-Click Interrupt & the OS Program Loader
When you double-click an executable icon on your desktop:
2. Kernel mouse driver pushes input event to Window Manager (UI Event Loop)
3. Window Manager resolves the click location over the icon and triggers a
CreateProcess() / execve() system call4. OS Kernel Loader parses the executable headers (ELF / PE), verifying format, permissions, and required shared libraries.
5–7. Process Creation, Virtual Memory & Demand Paging
Process Control Block (PCB)
The OS assigns a unique Process ID (PID) and initializes a private Page Table. Every process receives its own independent virtual address space (Stack, Heap, Code, Data).
Demand Paging & Page Faults
The entire file is not loaded into RAM upfront! When the CPU fetches the entry-point address, a Page Fault occurs, and the OS transparently loads only the needed 4 KiB page from SSD into a RAM frame.
8–10. Kernel Scheduling & CPU Pipeline Execution
The OS kernel scheduler transitions the process's main thread from READY to RUNNING via a Context Switch:
│
Instruction Decoder interprets Opcode
│
Out-of-Order Execution in ALU / FPU / SIMD
│
L1/L2/L3 Cache & DRAM Memory Read/Write (Stack/Heap)
│
In-Order Architectural Retirement
11–13. System Calls, GPU Rendering & Process Termination
GPU Framebuffer & Monitor Display
When the application renders its UI window, it issues system calls to submit command buffers to the GPU driver. The GPU renders pixels into the VRAM framebuffer, which the display controller outputs to the monitor.
Process Exit & Resource Cleanup
When the user closes the window, an exit() system call triggers. The OS immediately reclaims all physical RAM frames, closes open file handles, and releases the PCB.
14. Master Diagram: End-to-End Program Lifecycle
🧠 Key Takeaways
- Program vs Process: A program is a dormant binary file resting on disk; a process is an active, executing instance living in memory.
- Double-Click: An electrical mouse interrupt triggers the OS window manager to initiate an executable loading request.
- Demand Paging: Applications do not load into RAM all at once; code is brought into physical memory lazily on demand via page faults.
- CPU Execution: The OS scheduler assigns threads to cores, and the superscalar pipeline churns through billions of instructions per second.
- System Calls: User applications communicate with hardware, storage, and GPU drivers securely via kernel system calls.
- Clean Termination: Upon termination, the operating system recovers every byte of memory and closes all handles, ensuring system stability.
Lesson 24 — Computer Networks & Hardware Interrupts: Connecting Beyond the Machine
Explore the world of networking and asynchronous hardware communication—Ethernet, MAC addresses, packets, routers, network interface cards, and interrupt controllers.