20210101 PHIL WASM - orbitalfoundation/wiki GitHub Wiki

This is a survey of WASM.

What is it?

WebAssembly (WASM) describes a memory-safe, sandboxed execution environment that may even be implemented inside existing JavaScript virtual machines. When embedded in the web, WebAssembly will enforce the same-origin and permissions security policies of the browser. WebAssembly the name is a moniker for the idea of a portable binary-code format for executable programs and a sandbox.

WebAssembly was originally designed as a way to have portable computation on the web. But it is quickly escaping that use and becoming a universal solvent.

Notably there are nascent efforts to formalize the surrounding sandbox with carefully scoped permissions - and we now see WASI emerging as a wrapper or "runner" for WASM modules.

https://webassembly.org/

https://en.wikipedia.org/wiki/WebAssembly

https://en.wikipedia.org/wiki/WebAssembly#WASI

Why is yet another byte code assembly abstraction useful?

Although similar to Java, in the sense of being a platform agnostic byte code, it isn't as philosophically bound to a bunch of default libraries. It can be run in embedded environments, on the edge, and on richer devices. Two good examples of this are the use of WASM in the browser and then as well the way FASTLY is using Lucent to drive WASM on the edge. Another good example is Cloudflare Workers. This all shows the promise of WASM as a general purpose computational foundation - allowing computation to move around seamlessly.

More to the point - it is winning adoption. It helps programmers to have a consistent thinking environment around work. This allow for better security understanding and efficiencies of scale that emerge from larger shared ecosystems (shared practices, shared code, more people talking and thinking, more expertise). See https://adlrocha.substack.com/p/adlrocha-can-wasm-become-the-new .

Basic use on the web

Web assembly in conventional browsers is usable like so:

https://developers.google.com/web/updates/2018/04/loading-wasm

https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts

https://developers.google.com/web/updates/2018/04/loading-wasm

Challenges - Late Binding

There are still many challenges. We need to find ways to package WASM modules, have them communicate, and there are still web aspects that are troublesome. WASM blobs in browsers cannot talk directly to each other for example yet.

See:

https://www.infoq.com/news/2020/05/webassembly-summit-containerless/

https://opencontainers.org

https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md

"To fully realize the potential of WebAssembly it should be possible for a WebAssembly module author to target an output profile that maximizes the number of clients that can reuse their module (where a "client" can be another WebAssembly module, a native language runtime that embeds WebAssembly or some other kind of host system). As part of this maximum-reuse profile, the language and toolchain that a module author uses should be kept an encapsulated module implementation detail allowing module clients to independently choose their own language and toolchain.

This in turns allows for the emergence of a single, unified WebAssembly ecosystem of maximally-reusable modules. In contrast, the path of least resistance, and thus the default outcome if no effort is made to the contrary is for the WebAssembly ecosystem to be fragmented along the lines of language and toolchain."

WASI

WASI attempts to start to define standards:

https://en.wikipedia.org/wiki/WebAssembly#WASI

https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-tutorial.md

https://wasi.dev -> https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md

https://blog.jeremylikness.com/blog/explore-wasi-from-your-browser

ECOSYSTEM PLAYERS

BYTECODE ALLIANCE

https://bytecodealliance.org/#projects-of-the-alliance

https://bytecodealliance.org/

https://www.infoq.com/news/2020/10/bytecode-alliance-one-year/ -> bytecode alliance ->

FASTLY

https://www.youtube.com/watch?v=QdWaQOgvd-g. <- https://www.fastly.com/. <- VERY GOOD

https://hacks.mozilla.org/2020/10/a-new-backend-for-cranelift-part-1-instruction-selection/

https://www.fastly.com/blog/announcing-lucet-fastly-native-webassembly-compiler-runtime

SECOND STATE

“In the blog post, Clark and Schneidereit laid out their technology vision for the future of Wasm-on-the-server. Core to their vision is the nanoprocess model, which provides a secure and lightweight container for Wasm programs yet still makes it easy for sandboxed Wasm programs to communicate with each other and with the rest of the system.”

https://www.infoq.com/articles/server-side-wasm-second-state/

https://www.computer.org/csdl/magazine/so/5555/01/09214403/1nHNGfu2Ypi

In this article, we demonstrate that lightweight high-level runtimes, such as WebAssembly, could offer performance and scaling advantages over existing solutions and could enable fine-grained, pay-as-you-use business models.

https://www.computer.org/csdl/magazine/so/5555/01/09214403/1nHNGfu2Ypi -> “pay as you go business models” SAAS?

UNITY

Unity has an exporter to WebAssembly.

https://softwareengineeringdaily.com/2018/09/25/unity-and-webassembly-with-brett-bibby/

Brett Bibby is VP of engineering at Unity, and he joins the show to describe how Unity applications are built.

Since Unity SDKs allow Unity code to run across all the different platforms.

This requires writing and maintaining native code libraries for each of these devices.

MICROSOFT / AZURE / KRUSTLETS

https://cloudblogs.microsoft.com/opensource/2020/04/07/announcing-krustlet-kubernetes-rust-kubelet-webassembly-wasm/

GVISOR

https://gvisor.dev/docs/

CLOUDFLARE WORKERS

https://workers.cloudflare.com/

WASCC

https://wascc.dev/

https://wascc.dev/post/assemblyscript-actor/

https://github.com/waPC ? Web assembly procedure calls?

https://kevinhoffman.medium.com/introducing-wapc-dc9d8b0c2223

WASM IN SPACE

https://kevinhoffman.medium.com/f-prime-f-code-in-space-and-webassembly-69f443a4aca0

REDOX

https://www.redox-os.org/

https://en.wikipedia.org/wiki/Redox_(operating_system)

While not actually WASM based - it attempts to recreate aspects of the WASM/WASI ecosystem in a standalone kernel environment

https://doc.redox-os.org/book/ch01-08-side-projects.html

TOCK

https://www.tockos.org/

This is another microkernel - really much smaller and lighter than REDOX with a focus on embedded microcontrollers. But there is still an idea of process separation

BEVY

WASMER (an alternative to WASMTIME - very similar in fact)

https://medium.com/wasmer/wasmer-1-0-3f86ca18c043

(Also see https://wapm.io/)

RustOS

https://os.phil-opp.com/

How to build an operating system from scratch - using Rust in this case

RUSTOS DEV COMMUNITY

https://rust-osdev.com/this-month/2020-04/