Mozilla is going to use WASI for all devices, computers and operating systems

Original author: Thomas Claburn
  • Transfer

Hello! Connected TestMace and we continue to acquaint you with the hottest news from the JavaScript world. The next step is the translation of an article about WASI, a technology that allows WebAssembly to be used outside of browsers


One format to rule all



Mozilla introduced a project called WASI (WebAssembly System Interface) this week to standardize how WebAssembly code interacts with the operating system. If the project is successful, it will perform the same functions as the Oracle Java virtual machine, but much more efficiently and with advanced functionality.


WebAssembly (WASM) is a binary instruction format for a virtual machine that can run on various hardware architectures. Code written in many languages ​​like C / C ++, Go, Rust can be compiled into WASM code.


Many web browsers have introduced support for WebAssembly, but up to this point there was no standard to work with it outside the browser. And now there was WASI.
“There needs to be a way for code to interact with the system outside the browser, that is, a system interface,” said Mozilla developer Lin Clark in this Mozilla Hacks blog post . "The WebAssembly platform does not yet have such a method."


WASM + WASI


Using WASI, WASM code can be run in a browser or any other compatible environment, which provides cross-platform language-independent development. While the portable operating system interface (POSIX) aims to ensure portability of program source code between UNIX-like operating systems, WASI is designed to support the compatibility of compiled binary files on different devices and operating systems. The standard provides a universal runtime, the speed of which is close to native.


The Java Virtual Machine (JVM) does the same thing, but a plugin is required to run Java code in the browser. Although the flexibility of the language, such as the proposed WebAssembly platform, can be achieved in Java using GraalVM , the Java ecosystem is still in the background due to events related to Oracle's claims of infringement of their intellectual property.


The WASM format, providing secure access to memory and convenient validation , has an advantage over Java applets in terms of security, although it can be attacked to change the initial control flow of the program . It also gets along well with C / C ++ and Rust.


Mozilla’s WebAssembly team leader, Till Schneider, explains the difference between WebAssembly and Java on Twitter as follows: "WebAssembly was designed to scale from miniature devices to huge server groups or CDNs. The format is much more language-independent than Java, and implementation is far less resource intensive. "


If the potential advantages of WASI are not yet obvious to you, here is what one of the creators of Docker Solomon Hykes said about him: “If WASM + WASI existed in 2008, it would not have occurred to us to create Docker. Server-side WebAssembly is the future for that Computing. We lacked a standardized system interface. I hope WASI solves this problem! "


On this wave of optimism, Fastly on Thursday released Lucet , the native compiler and environment for executing WebAssembly WASM code in cloud environments. It complements Mozilla Wasmtime, a WASM code runtime environment outside the browser.


Of course, WASI is still far from ideal. WebAssembly would also be nice to further refine, for example, add the ability to access the browser DOM . Although the developers have already done an excellent job by providing a single platform-independent binary format. In the meantime, I wish you a successful experience with Java.


Also popular now: