tags:

views:

539

answers:

9
+18  Q: 

What is "runtime"?

I have heard about things like "C Runtime", "Visual C++ 2008 Runtime", ".NET Common Language Runtime", etc.

  • What is "runtime" exactly?
  • What is it made of?
  • How does it interact with my code? Or maybe more precisely, how is my code controlled by it?

When coding assembly language on Linux, I could use the INT instruction to make the system call. So, is the runtime nothing but a bunch of pre-fabricated functions that wrap the low level function into more abstract and high level functions? But doesn't this seem more like the definition for the library, not for the runtime?

Are "runtime" and "runtime library" two different things?

+17  A: 

Runtime is a general term that refers to any library, framework, or platform that your code runs on.

The C and C++ runtimes are collections of functions.

The .Net runtime contains an IL interpreter, a garbage collector, and more.

SLaks
The C++ standard library does not only contain functions, and refering to Matt Ball, the C and C++ "runtime" are runtime libraries, the .NET runtime is a runtime library and a runtime system.
smerlin
My question is that static libraries are runtime too? i guess the term is used mostly for shared objects, isn't it? consider libc in linux. And what about platforms and frameworks? they too are broken down into libraries?
Green Code
+1  A: 

Hi,

These sections of the MSDN documentation deal with most of your questions: http://msdn.microsoft.com/en-us/library/8bs2ecf4(VS.71).aspx

I hope this helps.

Thanks, Damian

Damian Schenkelman
Actually, it doesn't; he isn't only asking about .Net.
SLaks
@SLaks: You are absolutely right. That's why I said most.
Damian Schenkelman
And thankfully .NET is not the only runtime in the world.
Matt Joiner
@Matt: Right again. However 2/3 of his runtimes were supported by .Net, 1/2 of his tags deal with .Net and I just thought the links would be useful.
Damian Schenkelman
I'd phrase it "3/4 of the languages support .NET". .NET doesn't do a whole lot of supporting, it's designed to keep the rift strong between unix and windows at the middleware level.
Matt Joiner
+6  A: 

As per Wikipedia: runtime library/run-time system.

In computer programming, a runtime library is a special program library used by a compiler, to implement functions built into a programming language, during the runtime (execution) of a computer program. This often includes functions for input and output, or for memory management.


A run-time system (also called runtime system or just runtime) is software designed to support the execution of computer programs written in some computer language. The run-time system contains implementations of basic low-level commands and may also implement higher-level commands and may support type checking, debugging, and even code generation and optimization. Some services of the run-time system are accessible to the programmer through an application programming interface, but other services (such as task scheduling and resource management) may be inaccessible.


Re: your edit, "runtime" and "runtime library" are two different names for the same thing.

Matt Ball
Wikipedia is not a good source for quotes. It is a good location to start looking for authoritative sources but itself should not be considered authoritative and as such quoting from it is not reliable. (As per the statements by Mr Wales the creator of Wikipedia).
Martin York
+8  A: 

In my understanding runtime is exactly what it means - the time when the program is run. You can say something happens at runtime / run time or at compile time.

I think runtime and runtime library should be (if they aren't) two separate things. "C runtime" doesn't seem right to me. I call it "C runtime library".

Answers to your other questions: I think the term runtime can be extended to include also the environment and the context of the program when it is run, so:

  • it consists of everything that can be called "environment" during the time when the program is run, for example other processes, state of the operating system and used libraries, state of other processes, etc
  • it doesn't interact with your code in a general sense, it just defines in what circumstances your code works, what is available to it during execution.

This answer is to some extend just my opinion, not a fact or definition.

Michał Trybus
+2  A: 

Runtime describes software/instructions that are executed while your program is running, especially those instructions that you did not write explicitly, but are necessary for the proper execution of your code.

Low-level languages like C have very small (if any) runtime. More complex languages like Objective-C, which allows for dynamic message passing, have a much more extensive runtime.

You are correct that runtime code is library code, but library code is a more general term, describing the code produced by any library. Runtime code is specifically the code required to implement the features of the language itself.

e.James
+1  A: 

Run time exactly where your code comes into life and you can see lot of important thing your code do.

Runtime has a responsibility of allocating memory , freeing memory , using operating system's sub system like (File Services, IO Services.. Network Services etc.)

Your code will be called "WORKING IN THEORY" until you practically run your code. and Runtime is a friend which helps in achiving this.

saurabh
+1  A: 

The runtime or execution environment is the part of a language implementation which executes code and is present at run-time; the compile-time part of the implementation is called the translation environment in the C standard.

Examples:

  • the Java runtime consists of the virtual machine and the standard library

  • a common C runtime consists of the loader (which is part of the operating system) and the runtime library, which implements the parts of the C language which are not built into the executable by the compiler; in hosted environments, this includes most parts of the standard library

Christoph
+1  A: 

Matt Ball answered it correctly.

I would say about it with examples.

Consider running a program compiled in Turbo-Borland C/C++( version 3.1 year 1991) compiler and let it run under a 32-bit version of windows like Win 98/2000 etc.

Its a 16 bit compiler. And you will see all your programs have 16 bit pointers. Why is it so when your OS is 32bit ? Yeah!! it is because your compiler has setup the execution environment of 16 bit and the 32 bit version of OS supported it.

What is commonly called as JRE (Java Runtime Environment) provides a Java program with all the resources it may need to execute.

Actually runtime environment is brain product of idea of Virtual Machines. A virtual machine implements the "raw" interface between hardware and what a program may need to execute. The runtime environment adopts these interfaces and presents them for the use of programmer. A compiler developer would need these facilities to provide an execution environment for its programs.

RIPUNJAY TRIPATHI
+1 nice examples.
Lazer
A: 

Runtime is somewhat opposite to design-time and compile-time/link-time. Historically it comes from slow mainframe environment where machine-time was expensive.

RocketSurgeon