What is the role of a runtime environment?

4.3k Views Asked by At

In basic terms, what is a runtime environment, and what is it's role/purpose?

Also, could you give me any web related examples? (Is XAMPP one?)

2

There are 2 best solutions below

0
On

The answer from RichColours is technically correct. However, in practice people also refer to a runtime environment as all the third party software you need for running your application.

If you are developing an web application this will also include the web server or database that is required for make your application work. The runtimes themselves are the programming languages (PHP, Java, Python and Ruby), but if you want to run your application you need a full environment that may include Apache, Passenger, Tomcat, MySQL, PostgreSQL, etc. Usually additional libraries as OpenSSL, curl, libxml, may be required. For instance I am a developer at BitNami, and we offer full environments for developing and deploying web applications (similar to XAMP, as you mention). Most of the time we call them "stacks" but our users ( and many times ourselves) also call them runtime environments.

0
On

Runtime environment can consist of several things.

http://en.wikipedia.org/wiki/Run-time_system talks about some code that runs before the "program that you wrote" actually gets executed.

They come in various levels of complexity. The C runtime on Windows will do things like create a Process and a Thread for a console app, grab and prepare any environment variables etc and call the int main(argc, argv) function. However, Java and .NET runtime systems do a lot more: they instantiate virtual machine, memory managed environments. These have many threads, one of which will be running your code at some point.

In Java, the runtime environment can be interacted with via the java.lang type objects, like Thread. In C on Windows or Linux, one uses external libraries to do this. So runtime environments may provide functionality in some cases, but not in others.

Probably one of the very few software systems that do not have a runtime environment is the bare-to-the-metal embedded systems exmaple. This is where C code is written knowing that there is NO operating system, scheduler, concept of a Process or Thread, DOS prompt, memory manager, anything. There is however usually some boilerplate C code that is linked in and run immediately before the main() entry point is executed. This is probably written in assembler, and initialises a Stack.

Re XAMPP, this is not really a runtime environment, because it is merely a set of server packages. Any code you write is either in PHP, Perl, or code inside the MySQL db. PHP and Perl arguably have runtime environments of their own in which the script code runs. But no, XAMPP i'd say is not a runtime environment.

ASP.NET and Java Server Pages (or whatever it's called nowadays - the server-side Java stuff which used to be in Glassfish - Java EE that's it!) provide runtime environments to code that you write.