📜 ⬆️ ⬇️

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

Hello! In touch TestMace and we continue to acquaint you with the hottest news from the world of JavaScript. The next step is the translation of an article about WASI - a technology that will allow using WebAssembly outside of browsers.


One format to rule everyone



This week Mozilla presented a project called WASI (WebAssembly System Interface), designed to standardize the interaction of WebAssembly-code 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 WebAssembly support, but until this point there was no standard for working with it outside of the browser. And now WASI has appeared.
"We need a way to interact with the code outside the browser, that is, the system interface," explained Mozilla developer Lin Clark in this Mozilla Hacks blog post . "The WebAssembly platform has no such method yet."


WASM + WASI


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


The Java Virtual Machine (JVM) does the same thing, but a plugin is required to run Java code in the browser. Although language flexibility similar to the proposed WebAssembly platform can be achieved in Java using GraalVM , the Java ecosystem is still overshadowed by events related to Oracle’s claims to infringe their intellectual property.


WASM format, providing security of access to memory and convenient validation , has an advantage over Java applets in terms of security, although it can be subjected to attacks aimed at changing the initial flow of control of the program . He also gets along well with C / C ++ and Rust.


Mozilla’s leading WebAssembly team leader, Till Schneiderite, 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 demanding on resources. "


If the potential advantages of WASI are not obvious to you, then one of the creators of Docker Solomon Hayks said about him: "If WASM + WASI existed in 2008, we would not even think of creating a Docker. WebAssembly on the server side - this is the future calculations. We lacked a standardized system interface. I hope WASI will solve this problem! "


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


Of course, WASI is still far from ideal. WebAssembly would also be a good idea to further refine, for example, add the ability to access the browser's DOM . Although the developers have already tried their best, providing a single platform-independent binary format. In the meantime, I wish you a successful experience with Java.


Our team creates a cool TestMace tool - a powerful IDE for working with APIs. Create scripts, test endpoints and use all the power of advanced autocompletion and syntax highlighting. Write to us! We are here: Telegram , Slack , Facebook , Vk


')

Source: https://habr.com/ru/post/449554/


All Articles