A computer program, often simply called a program, is a finite, ordered set of instructions that a computer can execute to carry out a specific task or solve a defined problem. In software, the program is the basic unit of executable logic: it exists first as human-readable source code and is then translated or interpreted into operations that a processor can perform.
Every piece of software, from a command-line utility to an operating system kernel, consists of one or more programs together with supporting data, libraries and configuration. Understanding what a program is, and how it moves from text to running process, is a foundation for the rest of software fundamentals.
How a computer program is built and executed
A program passes through a lifecycle from source to execution. A developer writes source code in a programming language, a toolchain converts it into a runnable form, the operating system loads that form into memory, and the processor executes its instructions one after another, branching and looping as the logic requires.
The translation step differs by language. Compiled languages such as C, C++, Rust and Go are converted ahead of time into machine code packaged in an executable file. Interpreted languages such as Python and shell scripts are read and executed by an interpreter at run time. Many modern languages, including Java and C#, use a hybrid model: source is compiled to bytecode, which a virtual machine runs and often optimizes with just-in-time compilation.
The table below summarizes the main stages a program typically passes through.
| Stage | What happens | Typical tools |
|---|---|---|
| Writing | Developer expresses logic as source code | Text editor, IDE |
| Translation | Source becomes machine code or bytecode | Compiler, assembler, bytecode compiler |
| Linking | Separate modules and libraries are combined | Linker, package manager |
| Loading | Operating system maps the program into memory | Loader, dynamic linker |
| Execution | Processor runs instructions as a process | CPU, runtime, interpreter |
Core components inside a program
Most programs share a common internal structure regardless of language. They contain instructions that perform operations, data that those instructions act on, and control flow that decides which instructions run and in what order. The three fundamental control structures are sequence, selection and iteration, a principle established by structured programming theory.
When a program runs, the operating system gives it an address space divided into regions. The code segment holds executable instructions, the data segment holds global variables, the stack holds function calls and local variables, and the heap holds memory allocated dynamically while the program runs.
- Entry point: the first instruction executed, such as a
mainfunction in C or Java. - Functions or procedures: named, reusable blocks of logic that accept inputs and return results.
- Variables and data structures: named storage for values, from simple integers to complex objects.
- Input and output: interaction with users, files, networks and devices, usually through operating system calls.
- Exit status: a numeric code returned on completion, where zero conventionally signals success.
Program, process, application and related terms
A program is a static artifact, while a process is a program in execution. The same program file can produce many simultaneous processes, each with its own memory and state, which is why opening two browser windows may start several independent processes from one installed program.
The following table distinguishes the program from neighboring concepts that are often used interchangeably.
| Concept | Definition | Key difference from a program |
|---|---|---|
| Computer program | Set of executable instructions for a task | The reference concept |
| Process | Running instance of a program | Dynamic, has memory and state |
| Software | Programs plus data, libraries and documentation | Broader collection |
| Application software | Programs that serve end-user tasks | A category defined by purpose |
| Algorithm | Abstract step-by-step method | Not tied to any language or machine |
| Script | Program usually run by an interpreter | A delivery style, not a separate kind |
An algorithm describes how to solve a problem in principle; a program is a concrete implementation of one or more algorithms in a specific language for a specific environment. A shared library also contains executable code, but it has no entry point of its own and runs only when another program calls it.
Types of computer programs
Programs are commonly classified by the role they play in a computing system. The categories overlap, and a single product may contain programs of several types.
| Category | Purpose | Examples |
|---|---|---|
| System software | Manage hardware and provide services | Kernels, device drivers, boot loaders |
| Application software | Perform tasks for end users | Word processors, browsers, games |
| Utility software | Maintain and optimize a system | Backup tools, disk cleaners, archivers |
| Embedded software | Control dedicated devices | Firmware in routers, appliances, cars |
| Development tools | Create and test other programs | Compilers, debuggers, build systems |
Programs also differ by interface style. A command-line program reads typed commands and text input, a graphical program presents windows and controls, and a background service or daemon runs without direct user interaction, responding to events, schedules or network requests.
Correctness, limits and common misconceptions
A program does exactly what its instructions specify, not what its author intended, which is why defects arise. A software bug is a mismatch between specified and intended behavior, and fixing it usually requires changing the source code and producing a new version, often distributed as a software patch.
Programs also have theoretical limits. The halting problem, proved undecidable by Alan Turing in 1936, shows that no general procedure can decide for every program whether it will eventually stop. In practice, this is why fully automatic verification of arbitrary programs is impossible and why testing, code review and formal methods are combined.
The table below lists frequent misunderstandings and the accurate view.
| Misconception | Accurate view |
|---|---|
| A program and an app are different things | An app is a program, typically for end users |
| Source code runs directly on the processor | It must first be compiled or interpreted |
| One program equals one process | A program can run as many processes |
| A tested program is bug-free | Testing reveals defects but cannot prove absence |
| Executables run on any computer | They depend on processor architecture and operating system |
In everyday language
A computer program is like a recipe for a machine. A recipe lists ingredients and steps in a fixed order, and a cook follows them to produce a dish. A program lists precise steps that a computer follows to produce a result, such as showing a web page or saving a document.
The big difference is that a computer follows the steps exactly as written. A human cook can guess what a vague recipe means, but a computer cannot. If one step is wrong, the computer will repeat the same mistake every time until someone corrects the instructions.
Seen in the real world
A small accounting office receives about 300 supplier invoices each month as PDF files and spends roughly two working days copying their totals into a spreadsheet. An in-house analyst writes a short Python program of about 150 lines that opens each file, extracts the invoice number, date and amount, and writes them into a single table.
The program runs from the command line once a week. It reports any invoice it cannot read, so a person checks only those few cases by hand. After a month of testing against manually entered data, the office adopts it, and the monthly data entry drops from two days to under an hour. When a supplier changes its invoice layout, the analyst updates one function, which shows how a program keeps working only as long as its instructions match reality.