Top Qs
Timeline
Chat
Perspective

Execution (computing)

Performing the actions encoded in a computer program From Wikipedia, the free encyclopedia

Remove ads

In computing, execution is the process by which a computer program is processed to perform the actions that it encodes. As the processor follows the program instructions, effects are produced in accordance with the semantics of those instructions. The term run is generally synonymous. The act of starting execution is often called launching or invoking in addition to executing and running.

An execution processor comes in many forms. A machine code program may be executed via the programmable interface of a computer or virtual machine where execution involves repeatedly following a fetch–decode–execute cycle for each program instruction executed by the control unit. Source code may be executed by interpreter software. A program may be executed in a batch process without human interaction or a user may type commands in an interactive session.

Remove ads

Platform independence

Often, software relies on external services such as a runtime environment and a runtime library tailored to the host environment to provides services that can decouple an executable from direct manipulation of the computer and its peripherals, and thus provide a more platform-independent solution.

Runtime error

Summarize
Perspective

A runtime error is detected after or during the execution (running state) of a program, whereas a compile-time error is detected by the compiler before the program is executed. Type checking, register allocation, code generation, and code optimization are typically done at compile time, but may be done at runtime depending on the particular language and compiler. Many other runtime errors exist and are handled differently by different programming languages, such as division by zero errors, domain errors, array subscript out of bounds errors, arithmetic underflow errors, several types of underflow and overflow errors, and many other runtime errors generally considered as software bugs which may or may not be caught and handled by any particular computer language.

Exception handling supports handling runtime errors, providing a structured way to catch 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.

Remove ads

Debugging

Some debugging can only be performed (or is more efficient or accurate when performed) at runtime. Logic errors and array bounds checking are examples. For this reason, some programming bugs are not discovered until the program is tested in a production environment with real data, despite sophisticated compile-time checking and pre-release testing. In this case, the end-user may encounter a "runtime error" message.

Interpreter

A system that directly executes a program is an interpreter. Typically, interpreter refers to software but a CPU is also an interpreter; an interpreter implemented in hardware.

Virtual machine

Summarize
Perspective

A virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination.

Virtual machines differ and are organized by their function, shown here:

Some virtual machine emulators, such as QEMU and video game console emulators, are designed to also emulate (or "virtually imitate") different system architectures thus allowing execution of software applications and operating systems written for another CPU or architecture. OS-level virtualization allows the resources of a computer to be partitioned via the kernel. The terms are not universally interchangeable.

Remove ads

Host-native

Summarize
Perspective

This section focuses on host-native execution of a program written in a programming language other than assembly; CPU interpretation of machine-code generated from source code. Although this is a very common scenario for execution, other execution is commonly found.

Context switch

To support concurrent execution of multiple host-native executables, a multitasking operating system (OS) may support context switching. To swap out an executable (identified by a process-context identifier) from the execution environment, the OS saves its execution context data such as memory page addresses and register values. To swap it back in, the OS restores the data.[1]:3.3[2]

In a Linux-based operating system, a set of data stored in registers is usually saved into a process descriptor in memory to implement a context switch.[1] PCIDs are also used.

Program lifecycle

A host-native program written is a language other than assembly has distinct lifecycle phases. At design-time, the source code is authored by software developers. At compile time, the source code is processed into code that is more readily usable by the computer such as machine code or bytecode. At link time, an executable is produced that is ready for execution.

At run time (a.k.a. runtime and execution time), the machine code is executed by the computer's central processing unit (CPU). Control starts at the entry point and moves through the instructions of the program per the program's logic and input. The program runs until either it terminates or crashes.

Loading

When a program is started, a loader performs memory setup and links the program with any dynamically linked libraries it needs, and then execution begins at the program's entry point. In some cases, a language or implementation will have these tasks done by the language runtime instead, though this is unusual in mainstream languages on common consumer operating systems.

Runtime system

A runtime system is a software layer that provides services to an executable; portions of an execution model.[clarification needed] Related, a runtime environment (RTE) is everything that a program can interact with; including a runtime system.

Most programming languages include a runtime system. It may address issues including memory management, variable access, parameter passing mechanisms, operating system access, and more. The compiler makes assumptions depending on the specific runtime system to generate code. Typically, the runtime system has some responsibility for setting up and managing the stack and heap, and may include features such as garbage collection, threading or other dynamic features of the language.[3]

Instruction cycle

The instruction 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.

Thumb
This is a simple diagram illustrating the individual stages of the fetch-decode-execute cycle.

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 concurrently, and often in parallel, through an instruction pipeline: the next instruction starts being processed before the previous instruction has finished, which is possible because the cycle is broken up into separate steps.[4]

Remove ads

See also

  • Late linking – Operating system feature that integrates dynamic libraries into a program at runtime
  • Program counter – Register that stores where in a program a processor is executing

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads