A computer program is a set of instructions that tells a computer what to do
A computer program is a list of commands written in a language the computer understands. When you run a program, the computer reads those commands in order and performs the actions they describe. Every piece of software you use — your web browser, email client, word processor, or video game — is a program.
Programs are built from smaller pieces called functions or routines, each designed to do one specific task. A function might calculate a total, display text on your screen, or save a file to your hard drive. The programmer chains these functions together so that when you click a button or type something, the program knows what to do next.
The instructions in a program are written by humans in a programming language — a system of words and symbols that both humans and computers can understand. Common languages include Python, Java, C++, and JavaScript. Each language has its own rules, much like English or Spanish do, but they all serve the same purpose: telling a computer exactly what steps to take.
Key Takeaways
- A program is a sequence of instructions that a computer executes in order to perform a task or solve a problem.
- Programs are written in programming languages that use specific syntax and rules so the computer can parse and run them correctly.
- Large programs are built from smaller functions, each handling one specific job, which are combined to create complex behavior.
- Before a program can run, source code must be translated into machine code — either by a compiler or an interpreter — so the processor can understand it.
- Programs run in memory (RAM) while active and can read from or write to storage devices like hard drives or SSDs.
How source code becomes something your computer can run
When a programmer writes a program, they type it out in a text editor as source code. This is human-readable text that follows the rules of a programming language. However, your computer's processor does not understand Python or Java directly — it only understands machine code, which is instructions written as numbers.
To bridge this gap, source code must be translated. This happens in one of two ways. A compiler reads the entire program, translates it all at once into machine code, and saves the result as an executable file (like a .exe file on Windows). An interpreter reads the source code line by line and translates each line as it runs, without saving a separate executable file.
Compiled programs usually run faster because the translation happens once, before you ever run them. Interpreted programs are easier to test and debug because you can run them when ready and see errors as they happen. Many modern languages use a hybrid approach: they compile to an intermediate form, then interpret that form when the program runs.
What happens inside your computer when a program runs
When you launch a program, the operating system loads it from your hard drive or SSD into RAM (random access memory). RAM is much faster than storage, so the computer keeps the program and its data there while it is running. The processor then begins reading and executing the instructions one by one.
As the program runs, it may read data from your keyboard, mouse, or files on disk. It processes that data according to its instructions and produces output — text on your screen, sounds from your speakers, or new files saved to storage. If the program needs more memory than is available, the operating system may use virtual memory, which temporarily uses hard drive space as if it were RAM, though this is much slower.
When you close the program, the operating system removes it from RAM and frees up that memory for other programs to use. Any data the program created is kept only if the program explicitly saved it to your hard drive or another storage device.
The difference between programs and data
A program is a set of instructions. Data is the information that a program works with. When you open Microsoft Word, Word is the program — the instructions for displaying text, formatting it, and saving it. The document you type is data — the actual content that Word manipulates.
This distinction matters because the same program can work with many different pieces of data. Word can open thousands of different documents, each one a different set of data. A video game is a program; your saved game file is data. A web browser is a program; the web pages you visit are data that the browser displays.
Programs are usually stored as files with specific extensions that tell your operating system what kind of program they are. Data files have different extensions — .docx for Word documents, .jpg for images, .mp3 for audio. Your operating system uses these extensions to know which program to open when you double-click a data file.
Why programs need to be tested before release
Even small mistakes in a program's instructions can cause it to crash, produce wrong answers, or behave unpredictably. A bug is an error in the code that causes the program to not work as intended. Bugs can range from minor (a button label is misspelled) to severe (the program loses your data).
Before a program is released to the public, programmers and testers run it through many scenarios to find and fix bugs. They test normal use cases — the things users are supposed to do — and edge cases — unusual situations the program might not handle well. Automated tests run the same checks thousands of times to catch problems humans might miss.
Despite thorough testing, bugs sometimes slip through to released software. This is why programs receive updates: to fix bugs that users discover after release, to add new features, or to improve performance. You have probably seen notifications asking you to update your browser, operating system, or other software — those updates often include bug fixes.
Different types of programs and what they do
System software manages your computer's hardware and allows other programs to run. Your operating system (Windows, macOS, or Linux) is system software. So are device drivers, which let your computer talk to printers, graphics cards, and other hardware.
process software is what you use to do actual work or entertainment. Web browsers, email clients, photo editors, spreadsheets, and games are all process software. They rely on the operating system to handle the low-level details of talking to hardware.
Utility software performs specific maintenance or support tasks. Antivirus programs, file managers, backup tools, and disk cleaners are utilities. They usually run in the background or on demand, rather than being something you actively use all day.
Firmware is a special type of program stored directly on hardware devices. Your router, printer, and motherboard all contain firmware that controls how they operate. Firmware is usually updated less often than regular software, but updates are still released to fix bugs or add features.
How programs communicate with each other
Modern computers run many programs at the same time. Your operating system divides the processor's time among them so each gets a turn to execute its instructions. Programs can also share data with each other through files, clipboard data, or direct communication channels called APIs (process programming interfaces).
An API is a set of rules that one program uses to ask another program to do something. When you use a weather app on your phone, that app does not measure the weather itself — it sends a request through an API to a weather service's computers, which send back the current conditions. The app then displays that data to you.
Programs can also work together through plugins or extensions, which are smaller programs that add features to a larger program. Your web browser's ad blocker is a plugin. Photoshop's filters are plugins. These smaller programs run inside the larger one and use its APIs to access the data they need.
Frequently Asked Questions
Is every piece of software a program?
Yes. Software is a broad term that means any code running on a computer. A program is a specific piece of software designed to perform a task or set of tasks. The terms are often used interchangeably, though "software" can also refer to the entire collection of programs on a computer.
Can I see the source code of programs I use?
Open-source programs publish their source code publicly, so anyone can read it, modify it, or check it for security problems. Many popular programs like Firefox, VLC media player, and Linux are open-source. Proprietary programs like Windows and Photoshop keep their source code private.
What is the difference between a program and an app?
An app is usually a program designed for a mobile device like a phone or tablet, though the term is now used loosely for any small software tool. A program is a more general term that includes desktop software, mobile apps, web applications, and system software. The distinction is mostly about context and size, not function.
Do I need to understand programming to use a computer?
No. Most people use computers without ever writing code or understanding how programs work internally. However, knowing the basics helps you troubleshoot problems, understand why software behaves a certain way, and make informed decisions about which programs to use.
Why do programs sometimes freeze or stop responding?
A program freezes when it gets stuck waiting for something — a file to load from disk, a response from the internet, or a calculation to finish. If the wait takes too long, the program appears frozen. The operating system can usually force the program to close, and you can restart it. Frequent freezing usually means the program has a bug or your computer does not have enough memory or processing power.