What is executable?
An executable is a file that contains computer instructions (machine code) that a processor can run directly. When you double‑click a program or type its name in a terminal, the operating system loads this file into memory and starts executing the instructions inside it.
Let's break it down
- Machine code: The low‑level binary numbers that the CPU understands.
- Header: A small block at the start of the file that tells the OS how to load it (e.g., where the code begins, required libraries, memory layout).
- Sections: Parts of the file such as .text (actual code), .data (initialized variables), .bss (uninitialized variables), and .rdata (read‑only data).
- Entry point: The address where execution starts, usually a function called
main
or similar. - Metadata: Information like version, required OS version, and digital signatures.
Why does it matter?
Executables are the bridge between human‑written code and the hardware that runs it. Without them, software would remain as source code that the computer cannot understand. They allow you to launch applications, run games, install tools, and automate tasks with a single click or command.
Where is it used?
- Desktop and laptop applications (e.g., browsers, office suites).
- Mobile apps compiled to native binaries (APK on Android, .ipa on iOS).
- Server software and background services.
- Video games, utilities, and embedded firmware in devices like routers, printers, and IoT gadgets.
- Command‑line tools and scripts that have been compiled into binaries.
Good things about it
- Speed: Running native machine code is faster than interpreted or just‑in‑time compiled code.
- Self‑contained: All necessary instructions are packaged in one file, making distribution simple.
- Security controls: OS can verify signatures, enforce sandboxing, and apply permissions.
- Predictable behavior: The exact same binary will behave the same on any compatible system.
Not-so-good things
- Platform dependence: An executable built for Windows won’t run on macOS or Linux without compatibility layers.
- Size: Including all code and resources can make the file large.
- Security risk: Malicious executables can run harmful code if users execute them unknowingly.
- Harder to modify: Changing behavior requires recompiling the source, unlike scripts that can be edited directly.