3

My question is if the JVM actually provides a virtual operating system too, similar to how WASI does.

As for my understand WASM and JVM are both virtual machines, providing an environment to execute some bytecode. Their aim is to abstract the machine layer, thus CPU (architecture) and its' ISA.

WASM itself has no access to other system resources (fs, networking, ...) because of it's sandbox design. That's where WASI, as an extension to WASM, provides an abstract operating system layer, so that system resources can be accessed.

For Java applications, I can use native (Java) APIs, such as java.io/java.nio or java.net, directly on the JVM.

I understand that both approaches handle security differently. E.g. I do not need to provide access to a file myself to a Java application, but as with WASI I do need to. My question is rather if they conceptually provide similar levels of abstractions in case of the OS.

source to WASI: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/

EDIT: We continued discussing in the WASI repository. https://github.com/WebAssembly/WASI/issues/439

prohit
  • 609
  • 1
  • 6
  • 18
  • When you use Java, you can see the standard library as the system interface. You could call this a "virtual operating system", although that's not how people commonly name it. Your question is one of those "word game" questions that gets asked sometimes - people sometimes assume that technical terms always have very exact meanings (which isn't so) and then get lost in the exact definition of a term. So: Conceptually the Java std lib and the WASI sys interface are similar, but don't get too hung up on the exact correspondence and differences. – Jesper Jun 15 '21 at 11:17
  • Thanks for your clarification. I'm wondering how they differ in implementations. In WASI, supported functions that use system resources get compiled to their corresponding WASI counterpart. They are then provided from a WASI conform runtime, that is platform/os specific. How is it in Java? Do JVMs interpret methods that use std libs in the same abstract way and translate them to platform/os specific instructions? – prohit Jun 15 '21 at 12:43

0 Answers0