Content deleted Content added
m v2.04b - Bot T18 CW#553 - Fix errors for CW project (<nowiki> tags) |
Citation bot (talk | contribs) Removed URL that duplicated identifier. | Use this bot. Report bugs. | #UCB_CommandLine |
||
(42 intermediate revisions by 30 users not shown) | |||
Line 2:
{{Program execution}}
'''Execution''' in [[computer engineering|computer]] and software engineering is the process by which a [[computer]] or [[virtual machine]]
Programs for a computer may be executed in a [[Batch processing|batch process]] without human interaction or a [[User (computing)|user]] may type [[Command (computing)|commands]] in an [[Session (computer science)|interactive session]] of an [[Interpreter (computing)|interpreter]]. In this case, the "commands" are simply program instructions, whose execution is chained together.
Line 10:
== Process ==
{{see|Program lifecycle phase}}
Prior to execution, a program must first be written. This is generally done in [[source code]], which is then compiled at [[compile time]] (and statically linked at [[link time]]) to produce an executable. This executable is then invoked, most often by an operating system, which loads the program into memory ([[load time]]), possibly performs [[dynamic linking]], and then begins execution by moving control to the [[entry point]] of the program; all these steps depend on the [[Application Binary Interface]] of the operating system. At this point execution begins and the program enters [[run time (program lifecycle phase)|run time]]. The program then runs until it ends, either in a normal [[termination (computer science)|termination]] or a [[crash (computing)|crash]].
== Executable ==
Line 25:
{{Main|Context switch}}
In order for programs and [[interrupt handler]]s to work without interference and share the same hardware memory and access to the I/O system, in a [[Computer multitasking|multitasking operating
In Linux-based operating systems, a set of data stored in [[Processor register|registers]] is usually saved into a process descriptor in memory to implement switching of context.<ref name=":0" /> PCIDs are also used.
==Runtime==
'''Runtime''', '''run time''', or '''execution time''' is the final phase of a [[computer program]]{{'}}s [[Program lifecycle phase|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 [[Runtime error detection|runtime error is detected]] after or during the execution (running state) of a program, whereas a [[Compile time|compile-time]] error is detected by the [[compiler]] before the program is ever executed. [[Type checking]], [[register allocation]], [[code generation (compiler)|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 language|programming languages]], such as [[division by zero]] errors, ___domain errors, [[Bounds checking|array subscript out of bounds]] errors, [[arithmetic underflow]] errors, several types of underflow and [[overflow (disambiguation)|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.
=== Implementation details ===
When a program is to be executed, a [[loader (computing)|loader]] first performs the necessary [[memory (computers)|memory]] setup and links the program with any [[dynamic linking|dynamically linked]] [[software library|libraries]] it needs, and then the execution begins starting from 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.
Some program debugging can only be performed (or is more efficient or accurate when performed) at runtime. [[Logic error]]s and [[array data structure|array]] bounds checking are examples. For this reason, some programming [[software bug|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.
=== 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 ==
{{main|Runtime system}}
A ''runtime system'', also called ''runtime environment'', primarily implements portions of an [[execution model]].
Most [[programming language]]s have some form of runtime system that provides an environment in which programs run. This environment may address a number of issues including the [[memory management|management]] of application [[computer memory|memory]], how the program accesses [[variable (computer science)|variable]]s, mechanisms for passing parameters between [[subroutine|procedure]]s, interfacing with the [[operating system]], and otherwise. The [[compiler]] makes assumptions depending on the specific runtime system to generate correct code. Typically the runtime system will have some responsibility for setting up and managing the [[stack (abstract data type)|stack]] and [[heap (data structure)|heap]], and may include features such as [[garbage collection (computer science)|garbage collection]], [[thread (computing)|thread]]s or other [[dynamic programming language|dynamic]] features built into the language.<ref name="Aho_2007"/>
Line 56 ⟶ 69:
* '''Process virtual machines''' are designed to execute computer programs in a platform-independent environment.
Some virtual machine emulators, such as [[QEMU]] and [[video game console emulator]]s, 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. [[
==References==▼
{{Reflist|refs=▼
<ref name="Aho_2007">{{cite book |author-last1=Aho |author-first1=Alfred V. |author-link1=Alfred V. Aho |author-last2=Lam |author-first2=Monica Sin-Ling |author-link2=Monica Sin-Ling Lam |author-last3=Sethi |author-first3=Ravi |author-link3=Ravi Sethi |author-last4=Ullman |author-first4=Jeffrey David |author-link4=Jeffrey David Ullman |title=Compilers: Principles, Techniques and Tools |date=2007 |publisher=[[Pearson Education]] |___location=Boston, MA, USA |isbn=978-0-321-48681-3 |page=[https://archive.org/details/compilers00alfr_0/page/427 427] |edition=2nd |url-access=registration |url=https://archive.org/details/compilers00alfr_0/page/427}}</ref>}}▼
{{CPU_technologies}}▼
== See also ==
Line 69 ⟶ 76:
* [[Run time (program lifecycle phase)|Runtime program phase]]
* [[Program counter]]
▲==References==
▲{{Reflist|refs=
▲<ref name="Aho_2007">{{cite book |author-last1=Aho |author-first1=Alfred V. |author-link1=Alfred V. Aho |author-last2=Lam |author-first2=Monica Sin-Ling |author-link2=Monica Sin-Ling Lam |author-last3=Sethi |author-first3=Ravi |author-link3=Ravi Sethi |author-last4=Ullman |author-first4=Jeffrey David |author-link4=Jeffrey David Ullman |title=Compilers: Principles, Techniques and Tools |date=2007 |publisher=[[Pearson Education]] |___location=Boston, MA,
▲{{CPU_technologies}}
{{DEFAULTSORT:Execution (Computing)}}
|