liveBook · Manning

WebAssembly runtime

As explained in Refactoring to Rust

A WebAssembly runtime is software that loads, instantiates, and executes WebAssembly modules.

A WebAssembly runtime loads, instantiates, and executes compiled WebAssembly modules. WASI provides the interface between those modules and the host, allowing execution beyond a browser and without JavaScript. section 10.1

The runtime defines how host applications interact with external Wasm libraries through parameters and outputs. Modules can therefore be exchanged without changing or stopping the host application, provided they implement the expected interface. section 10.1

A Wasm runtime provides:

  • WASI-based integration between WebAssembly modules and host applications. section 10.1
  • A shared, sandboxed linear memory model for the virtual machine and module. section 10.8
  • A boundary where module functions allocate and deallocate memory for communication with the virtual machine. section 10.8

Running Wasm with WasmEdge

WasmEdge demonstrates one implementation of a universal Wasm runtime. Its SDK can consume Wasm modules, including applications such as a command-line search tool; a hello.wasm module can be downloaded and tested with the runtime. section 10.8 section 10.1

Figure 10.3 Wasm running in the WASI runtime
figure

Use the runtime diagram to trace how a Wasm module executes inside a WASI runtime. section 10.1

How Refactoring to Rust covers it

How deep it goes
Explains interpretation, host interfaces, sandboxed memory, and allocation functions, but does not detail runtime implementation internals.
Examples
Demonstrates WasmEdge installation, hello.wasm testing, and a command-line search application consuming Wasm.
What it assumes
Assumes familiarity with compiled WebAssembly and browser execution, then extends that model to independent host runtimes.
What you can do after
Operate/configure WasmEdge to consume WebAssembly modules through a WASI-compatible runtime.
How it connects
Connects WebAssembly modules with WASI, host applications, sandboxed linear memory, and the WasmEdge SDK.

Also explained in

Compare how 2 books explain WebAssembly runtime →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Refactoring to Rust. The section links point to the parts of the book it draws on.