A beginner-friendly guide to hosts in runtime design: the environment that owns the world where guest code runs.
Host is one of the clearest words for understanding runtime authority.
host runs guest codeTable of Contents
- The Simple Idea
- Host And Guest
- Why Hosts Matter
- What A Host Provides
- Host APIs
- Host As Boundary
- Examples
- My Learning Notes
- Common Misunderstandings
- Related Concepts
The Simple Idea
A host is the environment that runs or contains guest code.
The host owns the outside world.
The guest runs inside the rules the host provides.
host -> provides world
guest -> runs inside itHost And Guest
The host/guest model appears everywhere.
Examples:
- browser hosts page JavaScript,
- Node.js hosts server JavaScript,
- database hosts extension logic,
- game engine hosts scripts,
- VM hosts bytecode,
- server runtime hosts tenant code.
The host decides what the guest can access.
The guest does not automatically own the machine.
Why Hosts Matter
Hosts matter because code needs a world.
The host provides:
- memory model,
- APIs,
- files,
- network,
- database access,
- time,
- imports,
- permissions,
- lifecycle,
- error handling.
The same code can behave differently in different hosts.
What A Host Provides
A host may provide:
- built-in modules,
- native capabilities,
- standard library,
- global variables,
- runtime functions,
- event loop,
- scheduler,
- filesystem access,
- network access,
- database handles,
- rendering APIs.
What the host provides becomes part of the programming model.
Host APIs
Host APIs are the functions and objects a runtime exposes to guest code.
Example:
router
render
database
env
log
serverThese APIs should be deliberate.
Every host API is a power.
Host As Boundary
The host is the authority boundary.
It can decide:
- which imports exist,
- which secrets are visible,
- which tenant owns the request,
- which files can be served,
- which APIs can be called,
- when execution stops.
Runtime design is often host design.
Examples
Browser:
host: browser
guest: page JavaScriptCustom VM:
host: Go runtime
guest: bytecode programMulti-tenant platform:
host: platform engine
guest: tenant logicMy Learning Notes
Kitwork helped me feel the host/guest split clearly.
The Go engine is the host.
Tenant logic is guest code.
The VM, compiler, router, render system, env, and native capabilities all sit around that relationship.
The lesson:
runtime design starts when you ask what the host should expose to the guestCommon Misunderstandings
"Host just means server."
No. A browser, VM, database, or game engine can also be a host.
"Guest code can do whatever the language supports."
No. The host decides what APIs and powers exist.
"Host APIs are only convenience."
No. Host APIs define authority and boundary.
Related Concepts
Previous: grant
Next: native
Related: runtime, capability, vm