LOGBOOK

HELP

Quiz Entry - updated: 2026.07.07

What happens when you run a program like ./p24 5?

Three phases: the shell reads the command, the program is loaded from disk into memory, then the CPU executes its instructions.

Data flow for running ./p24 5: the shell reads the typed command from the keyboard into memory, the program is loaded from disk to main memory via DMA, then the CPU fetches and executes and the result goes to the display.

* Running a program moves data from keyboard to memory, loads the image from disk via DMA, then cycles through the CPU and out to the display. *

These phases trace one full trip of data through the machine — from the keyboard, into memory, through the CPU, and back out to the display — which is why this tiny example touches every major component of the system.

Phase 1: Reading command

  • Shell reads keyboard input character by character into memory
  • <Enter> signals end of command

Phase 2: Loading program

  • Shell searches for file p24 in current directory
  • Loads executable code and data from disk into main memory
  • Uses DMA (Direct Memory Access) - disk controller transfers directly to memory

Phase 3: Execution

  • CPU executes machine instructions from memory
  • Reads data, performs calculations
  • Sends output to display via graphics adapter

In the classic p24 example the program fills an array with A[i] = 1024 - i and prints the element whose index is the command-line argument, so ./p24 5 prints A[5]=1019 to the screen.

Data flow: Keyboard -> Memory -> CPU -> Memory -> Display

Go deeper:

From Quiz: REVE1 / Overview of Computer Systems | Updated: Jul 07, 2026