World Library  
Flag as Inappropriate
Email this Article

Run-time environment

Article Id: WHEBN0000197603
Reproduction Date:

Title: Run-time environment  
Author: World Heritage Encyclopedia
Language: English
Subject: Compilers: Principles, Techniques, and Tools, Adobe Flash Player, Adobe Integrated Runtime
Publisher: World Heritage Encyclopedia

Run-time environment

This article is about the infrastructure required to run programs. For execution phase in a programming language, see Run time (program lifecycle phase).

A run-time system (also called runtime system, runtime environment, or just runtime) implements the core behavior of a computer language. Every computer language implements[verification needed] some form of runtime system, whether the language is a compiled language, interpreted language, embedded domain-specific language, or is invoked via an API as is pthreads. In addition to the basic low-level behavior of the language, a runtime system may also implement higher-level behavior and even support type checking, debugging, or code generation and optimization.


As a simple example of a basic runtime, the runtime system of the C language is a particular set of instructions inserted into the executable image by the compiler. Among other things, these instructions manage the processor stack, create space for local variables, and copy function-call parameters onto the top of the stack. The reason this behavior is part of the runtime, as opposed to part of a keyword of the language, is that it is systematic, maintaining the state of the stack throughout a program's execution. The systematic behavior implements the execution model of the language, as opposed to implementing semantics that contribute to a particular computed result.

Another example, which illuminates the nature of a runtime system, is the case of using an application programming interface (API) to interact with a runtime. The calls to that API look the same as calls to a software library, however the runtime adds systematic behavior that implements an execution model. The API contains stub code that invokes the runtime, in contrast to a library which contains code that directly implements behavior. A person reading the code of a library would be able to understand the library's behavior by just knowing the language the library was written in. However, a person reading the code of the API that invokes a runtime would not be able to understand the behavior of the API call just by knowing the language the API was written in. They must also know the execution model implemented by the runtime system being invoked. This difference is what distinguishes an embedded-style language, such as posix threads, from a software library. Both posix-threads calls and library calls are invoked via an API, but posix-threads behavior cannot be understood in terms of the language being used. Rather, posix-threads calls bring into play an outside execution model, which is implemented by the posix-threads runtime.

Some compiled or interpreted languages provide an interface that allows application code to directly interact with the runtime system. An example is the Thread class in the Java language. Normally core aspects of a language's behavior such as task scheduling and resource management are not accessible in this fashion.

Higher level behaviors implemented by a run-time system may include tasks such as drawing text on the screen or making an Internet connection. It is often the case that operating systems provide these kinds of behaviors as well, and when available, the runtime is implemented as an abstraction layer, that translates the invocation of the runtime into an invocation of the operating system. This hides the complexity or variations in the services offered by different operating systems.

In the limit, the run-time system may provide services such as a P-code machine or virtual machine, that hide even the processor's instruction set. This is the approach followed by many interpreted languages such as AWK, and some languages like Java, which are meant to be compiled into some machine-independent pseudocode (bytecode). This arrangement greatly simplifies the task of language implementation and its adaptation to different machines, and allows sophisticated language features such as reflection. It also allows the same program to be executed on any machine without recompiling, a feature that has become very important since the diffusion of the World Wide Web.

A runtime may be modularized according to the proto-runtime approach.


Notable early examples of run-time systems are the interpreters for BASIC and Lisp. The latter also included a garbage collector. Forth is an early example of a language that was designed to be compiled into pseudocode; its run-time system was a virtual machine that interpreted that pseudocode. Another popular, if theoretical, example is Donald Knuth's MIX computer.

In C and later languages that supported dynamic memory allocation, the runtime also included a library that managed the program's memory pool.

In the object-oriented programming languages, the run-time system was often also responsible for dynamic type checking and resolving method references.

See also

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.