Execution (computing)
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
|
Notable runtimes |
|
Notable compilers & toolchains |
|
Execution in
Programs for a computer may be executed in a batch process without human interaction or a user may type commands in an interactive session of an interpreter. In this case, the "commands" are simply program instructions, whose execution is chained together.
The term run is used almost synonymously. A related meaning of both "to run" and "to execute" refers to the specific action of a user starting (or launching or invoking) a program, as in "Please run the application."
Process
Prior to execution, a program must first be written. This is generally done in
Executable
Executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, is a list of instructions and data to cause a computer "to perform indicated tasks according to encoded
The exact interpretation depends upon the use. "Instructions" is traditionally taken to mean machine code instructions for a physical CPU.[2] In some contexts, a file containing scripting instructions (such as bytecode) may also be considered executable.
Context of execution
The context in which execution takes place is crucial. Very few programs execute on a bare machine. Programs usually contain implicit and explicit assumptions about resources available at the time of execution. Most programs execute within multitasking operating system and run-time libraries specific to the source language that provide crucial services not supplied directly by the computer itself. This supportive environment, for instance, usually decouples a program from direct manipulation of the computer peripherals, providing more general, abstract services instead.
Context switching
In order for programs and
In Linux-based operating systems, a set of data stored in registers is usually saved into a process descriptor in memory to implement switching of context.[3] PCIDs are also used.
Runtime
Runtime, run time, or execution time is the final phase of a computer program's life cycle, in which the code is being executed on the computer's central processing unit (CPU) as machine code. In other words, "runtime" is the running phase of a program.
A
Implementation details
When a program is to be executed, a
Some program debugging can only be performed (or is more efficient or accurate when performed) at runtime.
Application errors (exceptions)
Exception handling is one language feature designed to handle runtime errors, providing a structured way to catch completely unexpected situations as well as predictable errors or unusual results without the amount of inline error checking required of languages without it. More recent advancements in runtime engines enable automated exception handling which provides "root-cause" debug information for every exception of interest and is implemented independent of the source code, by attaching a special software product to the runtime engine.
Runtime system
A runtime system, also called runtime environment, primarily implements portions of an
Most
Instruction cycle
The instruction cycle (also known as the fetch–decode–execute cycle, or simply the fetch-execute cycle) is the cycle that the central processing unit (CPU) follows from boot-up until the computer has shut down in order to process instructions. It is composed of three main stages: the fetch stage, the decode stage, and the execute stage.
In simpler CPUs, the instruction cycle is executed sequentially, each instruction being processed before the next one is started. In most modern CPUs, the instruction cycles are instead executed
Interpreter
A system that executes a program is called an interpreter of the program. Loosely speaking, an interpreter directly executes a program. This contrasts with a language translator that converts a program from one language to another before it is executed.
Virtual machine
A virtual machine (VM) is the
Virtual machines differ and are organized by their function, shown here:
- hardware-assisted virtualization, virtualization-specific hardware, primarily from the host CPUs.
- Process virtual machines are designed to execute computer programs in a platform-independent environment.
Some virtual machine emulators, such as
See also
- Executable
- Run-time system
- Runtime program phase
- Program counter
References
- ^ "executable". Merriam-Webster's Online Dictionary. Merriam-Webster. Retrieved 2008-07-19.
- ^ "Machine Instructions". GeeksforGeeks. 2015-11-03. Retrieved 2019-09-18.
- ^ OCLC 64549743.
- ^ "Difference between Swapping and Context Switching". GeeksforGeeks. 2021-06-10. Retrieved 2022-08-10.
- ISBN 978-0-321-48681-3.
- ^ Crystal Chen, Greg Novick and Kirk Shimano (2000). "Pipelining". Retrieved 2019-06-26.