Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Execution (computing)

From Wikipedia, the free encyclopedia
(Redirected fromRuntime (program lifecycle phase))
Performing the actions encoded in a computer program
Program execution
General concepts
Types of code
Compilation strategies
Notable runtimes
Notable compilers & toolchains

Incomputing,execution is the process by which acomputer program is processed to perform the actions that it encodes. As the processor follows the program instructions, effects are produced in accordance with thesemantics of those instructions. The termrun is generally synonymous. The act of starting execution is often calledlaunching orinvoking in addition toexecuting andrunning.

An execution processor comes in many forms. Amachine code program may be executed via the programmable interface of acomputer orvirtual machine where execution involves repeatedly following afetch–decode–execute cycle for each program instruction executed by thecontrol unit.Source code may be executed byinterpretersoftware. A program may be executed in abatch process without human interaction or auser may typecommands in aninteractive session.

Platform independence

[edit]

Often, software relies on external services such as aruntime environment and aruntime 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

[edit]

Aruntime error is detected after or during the execution (running state) of a program, whereas acompile-time error is detected by thecompiler 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 differentprogramming languages, such asdivision by zero errors, domain errors,array subscript out of bounds errors,arithmetic underflow errors, several types of underflow andoverflow 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 enableautomated 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.

Debugging

[edit]

Somedebugging can only be performed (or is more efficient or accurate when performed) at runtime.Logic errors andarray bounds checking are examples. For this reason, some programmingbugs are not discovered until the program is tested in aproduction 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

[edit]
Main article:Interpreter (computing)

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

Virtual machine

[edit]
Main article:Virtual machine

Avirtual machine (VM) is thevirtualization/emulation of acomputer system. Virtual machines are based oncomputer 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 asQEMU andvideo 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 anotherCPU or architecture.OS-level virtualization allows the resources of a computer to be partitioned via thekernel. The terms are not universally interchangeable.

Host-native

[edit]

This section focuses on host-native execution of a program written in aprogramming language other thanassembly; 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

[edit]
Main article:Context switch

To support concurrent execution of multiple host-native executables, amultitaskingoperating system (OS) may support context switching. To swap out an executable (identified by aprocess-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 inregisters is usually saved into a process descriptor in memory to implement a context switch.[1] PCIDs are also used.

Program lifecycle

[edit]
Further information:Program lifecycle phase

A host-native program written is a language other than assembly has distinct lifecycle phases. At design-time, the source code is authored bysoftware developers. Atcompile time, the source code is processed into code that is more readily usable by the computer such as machine code orbytecode. Atlink time, anexecutable 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'scentral processing unit (CPU). Control starts at theentry point and moves through the instructions of the program per the program's logic and input. The program runs until either itterminates orcrashes.

Loading

[edit]

When a program is started, aloader performsmemory setup and links the program with anydynamically linkedlibraries it needs, and then execution begins at the program'sentry 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

[edit]
Main article:Runtime system

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

Mostprogramming languages include a runtime system. It may address issues includingmemory management,variable access, parameter passing mechanisms,operating system access, and more. Thecompiler makes assumptions depending on the specific runtime system to generate code. Typically, the runtime system has some responsibility for setting up and managing thestack andheap, and may include features such asgarbage collection,threading or otherdynamic features of the language.[3]

Instruction cycle

[edit]
Main article:Instruction cycle

Theinstruction cycle is the cycle that thecentral processing unit (CPU) follows fromboot-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.

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 executedconcurrently, and often inparallel, through aninstruction 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]

See also

[edit]

References

[edit]
  1. ^abBovet, Daniel P. (2005).Understanding the Linux Kernel. Marco Cesati (3 ed.). Sevastopol, CA: O'Reilly.ISBN 0-596-00565-2.OCLC 64549743.
  2. ^"Difference between Swapping and Context Switching".GeeksforGeeks. 2021-06-10. Retrieved2022-08-10.
  3. ^Aho, Alfred V.;Lam, Monica Sin-Ling;Sethi, Ravi;Ullman, Jeffrey David (2007).Compilers: Principles, Techniques and Tools (2nd ed.). Boston, MA, US:Pearson Education. p. 427.ISBN 978-0-321-48681-3.
  4. ^Crystal Chen, Greg Novick and Kirk Shimano (2000)."Pipelining". Retrieved2019-06-26.
Models
Architecture
Instruction set
architectures
Types
Instruction
sets
Execution
Instruction pipelining
Hazards
Out-of-order
Speculative
Parallelism
Level
Multithreading
Flynn's taxonomy
Processor
performance
Types
By application
Systems
on chip
Hardware
accelerators
Word size
Core count
Components
Functional
units
Logic
Registers
Control unit
Datapath
Circuitry
Power
management
Related
Retrieved from "https://en.wikipedia.org/w/index.php?title=Execution_(computing)&oldid=1324641855#Runtime"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp