Skip to content
AgileLogics

Programming glossary

Runtime

The environment a program executes in while it's running, or the period of time during which it is running.

Two meanings of one word

"Runtime" shows up in two related senses, and context tells you which one is meant.

The first is a stretch of time: the period while your program is actually executing. When someone says "this error only happens at runtime," they mean the code looked fine beforehand but failed once it ran with real input. The opposite is compile time, when the code is being checked or translated.

The second sense is a piece of software: the environment that hosts your code while it runs. Node.js is a JavaScript runtime. It provides the engine that executes your JavaScript plus extras like file access and networking that browsers don't offer. The Java Virtual Machine is the runtime for Java bytecode. A runtime handles jobs your code depends on without ever mentioning them, such as allocating memory and reclaiming it through garbage collection.

A runtime error in action

This Python snippet is perfectly valid syntax, so nothing complains until the division actually happens:

def average(values):
    return sum(values) / len(values)

print(average([4, 8]))  # 6.0
print(average([]))      # ZeroDivisionError at runtime

The failure depends on the data passed in, which is why it can't be spotted ahead of time. Python raises it as an exception, which you can catch and handle.

Runtime vs language

JavaScript the language is the same whether it runs in Chrome or in Node.js, but the runtimes differ. A browser gives you document and window; Node gives you fs for reading files and process for environment details. Code that works in one runtime can fail in another because an API is missing, not because the language changed. Deno and Bun are further JavaScript runtimes, each with its own set of built-ins.

Many runtimes contain an interpreter, a JIT compiler, or both, working behind the scenes.

Learn more

Last updated