News for hackers. Stuff that matters.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by wokwokwok on Tuesday May 30, 2023 @11:52AM (#36126309)
So, let me get this straight…

WASM is a language independent byte code that runs in browsers, like “assembly but for browsers” that multiple languages can compile to instead of there only being javascript.

…but that ran in a browser sandbox, and people wanted to use it in containers, so they invented WASI, which lets WASM assembly code interact with the base system, sidestepping the container of the browser; but it needs a runtime on the host system (not a browser) to run.

Now this is WASIX which added more non standard extensions to WASI so that more programs can run on it.

We had an entire full stack cross platform runtime (browsers) to run our code in, but instead we now need to get a new set of “low level” runtimes to run the same code for, eg. containers?

Sounds a lot like java to me; byte code, runtime, “cross platform binaries”, write once, run anywhere…

How is this meaningfully different?

The only remarkable difference appears to be you can target it with existing c++ code?

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pie_flavor on Tuesday May 30, 2023 @12:10PM (#36126581)
Java is a language with a particular view of the world, and the JVM is a heavyweight runtime for executing that particular view of the world. The core idea of the JVM is great, and WASM executes that without assuming anything about your language, or requiring a great big tightly integrated second-banana-to-the-host-language's-stdlib system library, or anything else Java-y.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @12:23PM (#36126766)
And this why WASM is so great. No opinions on a language, APIs, or anything; just pure execution. Well, WASI and WASIX are APIs but they are not strictly obligatory.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @12:30PM (#36126868)
Only if one ignores the history of bytecode execution formats all the way back to late 1950's.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by dpe82 on Tuesday May 30, 2023 @04:11PM (#36130014)
For those of us less informed, care to explain?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by frant-hartm on Tuesday May 30, 2023 @12:42PM (#36127063)
When a wasm runtime supports garbage collection and all the already proposed APIs it will be comparable to nodejs or JVM.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @12:44PM (#36127088)
Let's hope that will never happen because it will lead to an imminent WASM death by making it opinionated.

I would also suggest to officially separate WASM from any notion of API. So that any working group anywhere in the world could design whatever API they want/need - but it would not wreck the purity of WASM as a result.

WASI/WASIX initiatives are good in that regard.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by brabel on Tuesday May 30, 2023 @02:27PM (#36128579)
WASM GC is already shipped with Chrome. Flutter is already compiling to WASM on the web and can execute with Chrome and apparently Firefox now, using the "native" GC instead of shipping one with the Dart runtime: https://docs.flutter.dev/platform-integration/web/wasm

EDIT : to clarify it, both Chrome and Firefox (nightly) require feature flags to enable WASM GC as of writing.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @02:55PM (#36128994)
What a perfect seppuku. RIP WASM, thou was fun while thou lasted.

The only chance of survival is to declare WASM GC a heresy and to largely ignore it until it rots away like Intel iAPX 432 did. But considering the financial model of the current WASM development this plan may be unrealistic.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by circuit10 on Tuesday May 30, 2023 @03:35PM (#36129493)
Well there needs to be an alternative... A GC implemented in WASM isn't ideal because it doesn't let you walk the stack so you need to make a second software stack which is slow, and it also increases the binary size a lot
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by foota on Tuesday May 30, 2023 @03:27PM (#36129390)
Why? You can still implement a WASM runtime with no GC, and so it's just additional functionality for where's its desirable. Additionally, the GC spec is low level and allows for pluggable GC, and better defines the WASM memory model.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @03:48PM (#36129672)
@foota, WASM GC is a bad development because it's opinionated.

For example, the nice WASM <-> CPU bijective mapping of capabilities is going to be lost. WASM GC now turns the WASM into something completely different, something in the rank of Java, .NET, Flash, Node JS, or Elang.

For any GC to work, there must be a notion of a component model that defines the type system and the rules of type interactions. This is a complex topic by itself with myriads of decisions and compromises to make. This means that the end result won't suite everyone, if anyone at all.

This will lead to WASM GC stagnation - it will be there but nobody will be using it because no one wants to loose the ground and compatibility with real CPUs. There may be some users like Dart or Flutter with their niche opinionated situations, but it's a drop in the ocean.

As the time will pass, WASM GC will be gradually becoming a burden as it does not come for free - it requires maintenance, patches, security fixes. In the end, browser vendors may proclaim the WASM a new "Flash", "Java Applet", "ActiveX" that should be eliminated due to overdesigned complexity, too wide API surface, and associated security risks.

Rinse and repeat, there is nothing new under the sun.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by TUSF on Tuesday May 30, 2023 @03:08PM (#36129149)
Last I checked, the GC primitives in WASM are rather low level, and are more for building a GC system on top of, rather than relying on it to be your whole GC.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ComputerGuru on Tuesday May 30, 2023 @05:27PM (#36131094)
As much as the broader programming world is loving WASM as a barebones VM and sandbox, it ultimately was created to further the interests of the organizations championing it and their desires and it's clear that making it a complete JS stand-in is the direction it is heading. GC is only a question of time.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by wbl on Tuesday May 30, 2023 @01:01PM (#36127345)
The great wheel continues to turn. If your wasm environment is a thin wrapper around the host you need to worry about the underlying system. So expect to see more and more abstraction or a break in portability. Similarly WASM assumes a lot about your language: imperative, statically typed, limited polymorphism, no GC (for now). It's not a good target for JS or Perl6 or Smalltalk or Common Lisp.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @01:07PM (#36127436)
WASM reflects the usual capabilities of a hardware-based CPU. Just like your usual hardware CPU cannot run Common Lisp directly, neither can WASM.

JS, Perl, Python etc. all run well on widespread CPU architectures like ARM and x64. And that's why they will run well on WASM too given an appropriate runtime for that language.

To sum it up, WASM assumes nothing about a language - it's just a CPU, albeit a virtual one.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by wbl on Tuesday May 30, 2023 @01:24PM (#36127674)
Obviously Church Turing tells us all substrates are the same in power. So when we talk about running well on X we mean something else.

WASM is not like any CPU in common use today. It's a stack machine with structured control flow and strongly typed pointers. The instruction sequence is a graph. Memory is not a flat address space.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by __s on Tuesday May 30, 2023 @01:33PM (#36127803)
I wouldn't call it a stack machine. Constraints requiring static stack depth is designed to be converted to SSA which then gets efficient register allocation
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ShroudedNight on Tuesday May 30, 2023 @01:22PM (#36127638)
My experience with CPython (a while ago now) was that it ran like a dog on POWER, and that if you didn't account for the idiosyncrasies of the architecture in the interpreter's implementation, running "well" was a pipe dream. Considering WASM actively masks the underlying architecture, what evidence is there that other managed runtimes will naturally run well on WASM?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @01:27PM (#36127707)
That's an interesting and open question. Especially the ability to JIT the code on the fly, so it could travel, say, Java -> WASM -> Hardware path. It seems that it technically possible [0] but there will be dragons.

[0] https://wingolog.org/archives/2022/08/18/just-in-time-code-g...

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by robotresearcher on Tuesday May 30, 2023 @01:57PM (#36128146)
> Just like your usual hardware CPU cannot run Common Lisp directly

Would be fun to visit the alternate universe where we went that way...

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

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by mepian on Tuesday May 30, 2023 @05:42PM (#36131312)
>Just like your usual hardware CPU cannot run Common Lisp directly, neither can WASM.

My usual hardware CPU runs Common Lisp code very well, thanks to this native x86-64 compiler: https://www.sbcl.org/

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by samsquire on Tuesday May 30, 2023 @12:25PM (#36126794)
I think we're always looking for the silver bullet that shall make computer software development easy.

The following technologies were all silver bullets:

* ActiveX, COM Object model, XPCOM

* Unified Modeling Language (UML)

* Extensible Markup Language (XML)

* Computer-aided software engineering (CASE)

* Java Virtual Machine

* Ionic, React Native, Qt, Gtk, Flutter

Something tells me that the problem is bigger than anyone can chew and the abstraction solution is sometimes more complicated than the underlying thing being abstracted.

I think WASI and WASIX is an EXTREMELY important API for the future of computing. It's a chance to create a superior operating system runtime interface.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by lifty on Tuesday May 30, 2023 @12:49PM (#36127173)
Why does it have the chance to be superior?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by samsquire on Tuesday May 30, 2023 @01:02PM (#36127360)
Compiling native application to operating systems that Wasmer is compiled for including the browser and have the code seamlessly work in all of them, I think that's really promising.

JVM forces you to write in Java or a JVM targeted language but WASM lets you compile any language that creates a WASM backend.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by vineyardmike on Tuesday May 30, 2023 @01:12PM (#36127505)
This

> JVM forces you to write in Java or a JVM targeted language

And this

> WASM lets you compile any language that creates a WASM backend

Are basically the same thing.

There’s no fundamental reason that all these languages couldn’t target JVM byte code instead of WASM. It never happened, not nearly as much as WASM backends are, but it could’ve.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ShroudedNight on Tuesday May 30, 2023 @01:34PM (#36127818)
It seems that NIH also manifests generationally:

? -> CORBA -> RMI -> SOAP -> REST -> GraphQL?

? -> SOA -> Microservices

? -> EDI / X12 -> XML -> JSON

p-code -> ? -> JVM -> WASM

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:23PM (#36129324)
Before P-Code there were other ones, there were lots of bytecode based platforms.

Burroughs, all Xerox PARC, Lisp Machines, OS/400, Oberon, Limbo, original Modula-2, QuickBasic, Amsterdam Compiler Toolkit, VB, ...

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by paulddraper on Tuesday May 30, 2023 @07:29PM (#36132580)
Okay, but have you used CORBA?

Or EDI?

It's like saying we had the Model T, but people just keep inventing new cars.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ShroudedNight on Tuesday May 30, 2023 @09:47PM (#36133559)
I have, albeit not terribly extensively. I will readily agree that there are cogent arguments for replacement that pass the Chesterton's Fence test. But I also see quite a lot of "That's too complicated to bother understanding, I'll just do my own thing"
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by laxd on Tuesday May 30, 2023 @01:37PM (#36127850)
> Compiling native application to operating systems that Wasmer is compiled for including the browser and have the code seamlessly work in all of them.

And thanks to stuff like this, contemporary browsers are now so complicated that they only run on the top handful of platforms. So how is it progress? I bet JVM still runs more places than modern browsers.

> VM forces you to write in Java or a JVM targeted language but WASM lets you compile any language that creates a WASM backend.

WASM forces you to write in something that has a WASM backend just like JVM forces you to write in something that has a JVM backend. It's just the same all over again. And again.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by the8472 on Tuesday May 30, 2023 @01:28PM (#36127729)
> It's a chance to create a superior operating system runtime interface.

But they're not doing io_uring style syscall queues.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by boricj on Tuesday May 30, 2023 @05:00PM (#36130736)
> I think WASI and WASIX is an EXTREMELY important API for the future of computing. It's a chance to create a superior operating system runtime interface.

Superior operating system runtime interface and POSIX don't rhyme. The fossilization of POSIX on Unix-like systems, endlessly piling stuff on top of that creaky foundation is probably the single biggest issue holding back the future of computing.

WASIX is probably a pragmatic design if you want to run your existing Unix programs on top of WASM. If anything, it's for the past of computing.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by syrusakbary on Tuesday May 30, 2023 @05:17PM (#36130954)
I wonder what is the system call ABI that your current operating system uses...
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by boricj on Tuesday May 30, 2023 @05:47PM (#36131382)
What the system call ABI that my modern operating system ought to have is not one that thinks fork() as a fundamental primitive is fit for purpose on modern computers [1], for starters. Mind you, my grievances on the design and typical implementation of Unix-like operating systems go far beyond fork(), but it's as good an entry point as any for this discussion.

I encourage you to read the design documents for the Fuchsia operating system, especially those for the Zircon kernel [2] for a fresh, legacy-free take on a system call interface.

[1] https://www.microsoft.com/en-us/research/uploads/prod/2019/0...

[2] https://fuchsia.dev/fuchsia-src/concepts/kernel

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by tokera on Wednesday May 31, 2023 @01:28AM (#36134787)
i coded the fork syscall, so I understand all this (f.y.i. I much prefer rust to C its much better designed).

what you must realize is that one does not have to use a syscall if they don't like it in (e.g. just use rust to code your app and it will never call the fork syscall)... but taking that choice away from others who want to use it is unfair as its denying them access to the WASM ecosystem (e.g. bash)

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by boricj on Wednesday May 31, 2023 @03:07AM (#36135385)
It looks like one can easily call fork() in an unsafe block from Rust [1], assuming it's provided by the target's libc.

OpenVMS for example does not provide fork(). What it does provide is vfork() by doing some internal book-keeping within the C run-time library and delaying the actual child process creation until exec() is called [2].

The POSIX specification eventually standardized posix_spawn() [3] as a partial alternative for fork() due to its numerous issues, some of which are detailed in the rationale section of its specification. Sadly, it appears its usage is not as widespread as it could be.

I'm not blaming the WASIX project for providing POSIX semantics since running POSIX-compliant programs is an explicit design goal. What I do wish is that more people realize that POSIX isn't the pinnacle of operating system interface engineering or some sort of holy scripture that shall not be questioned. It's 1970s legacy from long defunct hardware and obsolete software (think PDP-11 and Version 7 Unix) that was written down as a specification in the 1980s.

[1] https://docs.rs/libc/latest/libc/fn.fork.html

[2] https://vmssoftware.com/docs/VSI_C_RTL_REF_MAN.pdf

[3] https://pubs.opengroup.org/onlinepubs/9699919799/

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by jinwoo68 on Tuesday May 30, 2023 @11:59AM (#36126419)
I think you're basically correct. But wasm isn't tightly coupled with a single programming language, like Java did. Of course, other languages can target JVM too, but there's not much momentum there. With wasm, we have many different implementations written in many languages running in many different platforms. I think it's a good thing.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @12:31PM (#36126890)
Except JVM never was the only bytecode format in the history of computing.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by inadequatespace on Tuesday May 30, 2023 @12:19PM (#36126685)
> not much momentum

Scala? Kotlin?

To be fair these came into play WAY after the JVM

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by greenyoda on Tuesday May 30, 2023 @12:38PM (#36126990)
Also Clojure.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by throwaway894345 on Tuesday May 30, 2023 @12:48PM (#36127157)
These are all languages that were designed expressly to run on the JVM, whereas WASM aspires to support existing languages. I'm not familiar with JVM bytecode (and would love to hear from someone who is), but I'm guessing the JVM bytecode offers less in the way of low-level control over memory allocations and so on which would be required to compile C, C++, Rust, Go, etc programs with reasonable performance characteristics?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by brabel on Tuesday May 30, 2023 @02:49PM (#36128904)
JVM bytecode assumes the GC allocates and frees memory, so no, you don't have direct access to memory... though the Java standard library does let you allocate bytes and manage those yourself[1], not sure if you would consider that "more control over memory allocations".

JVM bytecode is quite approachable: https://en.wikipedia.org/wiki/List_of_Java_bytecode_instruct...

And does look superficially similar to WASM instructions. When WASM gets GC, I have trouble seeing what's fundamentally different between the two, to be honest... even something like (parts of) the Java stdlib will be available to WASM with the WASI API, making the difference too small to distinguish them into different categories IMO.

[1] https://blogs.oracle.com/javamagazine/post/creating-a-java-o...

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by throwaway894345 on Tuesday May 30, 2023 @03:54PM (#36129777)
> though the Java standard library does let you allocate bytes and manage those yourself[1], not sure if you would consider that "more control over memory allocations".

That's interesting. So if you wanted to build a C compiler targeting the JVM, you would just request a big byteslice from the API and implement your own stack + heap on top of it (such that you never actually use the JVM GC)?

> And does look superficially similar to WASM instructions. When WASM gets GC, I have trouble seeing what's fundamentally different between the two, to be honest... even something like (parts of) the Java stdlib will be available to WASM with the WASI API, making the difference too small to distinguish them into different categories IMO.

It sounds like the fundamental distinction is that WASM will have both manual memory management APIs as well as GC APIs while Java will only have GC APIs.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:24PM (#36129349)
CLR was designed for C++ as well. About 20 languages supported on release day.

IBM TIMI was designed for C and C++.

Amsterdam Compilers Toolkit was designed for Pascal, Modula-2 and C.

Nothing new really.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by throwaway894345 on Tuesday May 30, 2023 @04:00PM (#36129880)
I'm not really arguing that WASM was the first to target previously existing languages, I'm arguing that WASM has a reason to exist because (1) it's an extant project and (2) it solves for other requirements (e.g., streaming compilation) that weren't previously addressed. I could well be wrong, and if so I'd genuinely like to hear how CLR actually solves all of WASM's requirements (essentially how we should have just shoved CLR into browser engines and called it a day!).
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Wednesday May 31, 2023 @12:40AM (#36134531)
CLR didn't need to be shoved into the browser, it was there already via ActiveX first and Silverlight second.

As for the others since 1950's, plenty of stuff to study there.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ecnahc515 on Tuesday May 30, 2023 @01:06PM (#36127425)
Those languages are very much designed around the JVM though. You have Scala, but not eg: C++, because the JVM itself is much higher level than what many languages would want to target.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by duped on Tuesday May 30, 2023 @01:39PM (#36127885)
Arguably, JVM languages have much better tooling for them to be designed and interoperable (through Truffle and GraalVM) than WASM where everyone has to write a backend (or use LLVM which has its downsides).
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by brabel on Tuesday May 30, 2023 @02:43PM (#36128815)
The GraalVM JVM can run LLVM bitcode, hence C++:

https://www.graalvm.org/22.0/reference-manual/llvm/

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by reyqn on Tuesday May 30, 2023 @12:01PM (#36126441)
And with existing .Net, C, Go, Rust, Lua, Zig, Crystal, D, Elixir, also Java, JavaScript, Kotlin, Lisp, Nim, Pascal, Perl, PHP, Python, R, Ruby code (non-exhaustive list). That's a lot of flexibility
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @12:32PM (#36126901)
Just like the CLR in 2001!
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by doodlesdev on Tuesday May 30, 2023 @01:31PM (#36127764)
So here's the thing, CLR is still here (now called CoreCLR as of the move to .NET Core), how does it differ technically from WASM/WASI, and why aren't we using it instead?

I should note I haven't spent much time studying either of them.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:12PM (#36129185)
Mostly because Micro$oft shenanigans, or the fear thereof.

As if the VCs baking up all those WASM products are doing it from the warmth of their hearts.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by garganzol on Tuesday May 30, 2023 @03:23PM (#36129329)
They will do all the mistakes that have to be done. WASM GC is on of them.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Wednesday May 31, 2023 @01:51AM (#36134947)
Probably, then again if it was only for C and C++ style workloads, even one more reason to stick to the past.

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

Just one example out of many others, for C and C++ based workloads.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by throwaway894345 on Tuesday May 30, 2023 @12:41PM (#36127038)
The JVM expects that languages will conform to its bytecode specification, which is designed first and foremost for Java. WASM's bytecode specification is designed to support the existing ecosystem of languages including Rust, C, C++, Go, etc which can't easily target the JVM. Relatedly, the body which manages the JVM specification is comprised of major Java vendors and users; they don't represent developers of other languages even if the JVM nominally supports a few of them.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by kgeist on Tuesday May 30, 2023 @01:39PM (#36127891)
Microsoft's NET allowed you to compile C++ to pure CIL (.NET's bytecode) and run it inside a VM since the early 2000's. It wasn't very popular so it was deprecated.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by TUSF on Tuesday May 30, 2023 @03:28PM (#36129408)
> Microsoft's .NET

There's your problem.

Sure, .NET is technically cross-platform, but that's a relatively recent development, and WASM has runtimes that let it run in most environments, even microcontrollers.

Also, looks like C++/CLI had conflicting syntax with standard C++, so it might not have worked on some applications without some patches.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by postalrat on Tuesday May 30, 2023 @12:29PM (#36126853)
Existing c++, zig, rust, etc isn't the goal, it's the start.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by tlarkworthy on Tuesday May 30, 2023 @12:13PM (#36126616)
The worse thing is that WASI doesn't support browsers as a target anymore
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by flohofwoe on Tuesday May 30, 2023 @12:34PM (#36126932)
WASI (or rather POSIX) was never a good fit for the browser application model though. Emscripten did a pretty good job providing an incomplete "POSIX emulation layer" to get things rolling, but for WASM that needs to run in the browser it's better to go with Emscripten's web API mappings.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by preseinger on Tuesday May 30, 2023 @02:58PM (#36129033)
wasi was never intended for browsers

wasm isn't a browser-only thing

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by bmacho on Tuesday May 30, 2023 @12:08PM (#36126553)
I don't think it is meaningfully different than JVM. Why? Should it be?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @12:29PM (#36126856)
Got to get all that VC money, while trying to resell old ideas.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by stephc_int13 on Tuesday May 30, 2023 @12:57PM (#36127274)
>The only remarkable difference appears to be you can target it with existing c++ code?

That changes everything. Coupling the VM and the language was IMHO a huge mistake.

Wasm + WASI(X) + WebGPU is what the Java VM should have been. I guess we were not ready at the time.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:26PM (#36129365)
We were ready plenty of times, Java wasn't the first.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by paulddraper on Tuesday May 30, 2023 @01:02PM (#36127362)
> Sounds a lot like java to me; byte code, runtime, “cross platform binaries”, write once, run anywhere…

100%

WASM is "Java byte code for the 21st century."

> How is this meaningfully different?

It's lower level, making it a lighter, more flexible target platform for a variety of languages.

No classes, typing, GC (yet), required runtime, etc.

Whereas Java byte code is really only meant for Java (and similar -- Groovy, Clojure, Scala, Kotlin)

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by sroussey on Tuesday May 30, 2023 @01:05PM (#36127414)
It’s different from the browser sandbox in that it is targeting servers not clients.

That said, you can run a large subset in the browser.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:27PM (#36129383)
So basically CLR in 2001.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by paulddraper on Tuesday May 30, 2023 @03:56PM (#36129813)
Basically.

A key difference is that it's actually gaining traction on multiple platforms.

IDK if CLR tried and failed to do that, or just didn't try.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Wednesday May 31, 2023 @12:38AM (#36134522)
Mono, Xamarin, Project Rotor,...
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by moonchrome on Tuesday May 30, 2023 @01:05PM (#36127417)
Every thread about WASM is "this is just JVM".

No it's not. If you want to know how it's meaningfully different - go look look high level overview of JVM and WASM - and if you still don't get it - then you're probably not the target audience for either and you should just be using whatever the tool stack it's targeting them.

A bus and a cargo truck are not the same just because they have similar wheel base/size and abstractly do the same thing.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by jeroenhd on Tuesday May 30, 2023 @01:28PM (#36127719)
To me WASM just seems like the JVM without special OOP instructions.

It never started out that way, but it certainly is ending up that way. Everything that made WASM stand out from the traditional bytecode VM is being patched back in through extensions like WASI and now WASIX.

I was originally excited for WASM because it started out as a fully sandboxed system. No I/O other than flat memory buffers, so no chance whatsoever of escaping its sandbox.

Now WASIX introduces networking, file system I/O, mutltithreading, forking, even TTY support. It's not as powerful as the JVM yet, but give it a few years and I'm sure you can use them interchangeably in a few years.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by ShroudedNight on Tuesday May 30, 2023 @01:42PM (#36127930)
This reminds me of the old adage that the most secure computer is one that has never been, and can never connect to anything. It's also rather limited in its usefulness.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by jeroenhd on Tuesday May 30, 2023 @05:14PM (#36130914)
The limitations are what made WASM attractive to me. If I want a fast component to re-encode images, or to render a 3D scene, or to analyze and transform data, I don't want to have to set up a network namespace, alternate file system roots, and all the other annoying stuff that comes with sandboxing. WASM not being able to do or access anything you don't manually provide allows for quickly and easily hooking in executable code without the normal risks.

Add enough extensions to the runtime everyone uses and you end up with another JVM. The JVM is very good and so is the .NET runtime and any other bytecode runtime you can think of, but the distinctions start to fade as more features get tacked onto WASM.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by moonchrome on Tuesday May 30, 2023 @01:43PM (#36127945)
You can use cargo trucks to transport people and buses to transport cargo - so they are interchangeable ?

"Special OOP instructions" - you mean like object model and garbage collection ?

WASI is aiming to run in the browser sandbox which means it's API interface has to be more sandboxable than POSIX. Implementing POSIX compatibility layers on top of it is going to be leaky.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by jeroenhd on Tuesday May 30, 2023 @05:24PM (#36131048)
If you cut out the seats, attach a trailer hook up, put up a sheet behind the driver, and lower the engine, then you've created a truck out of a bus. There was no reason to turn a bus into a cargo truck and the result isn't better than any existing cargo truck, but your transformation altered what the original vehicle is likely to be used for.

Removing the limitations that make WASM such a safe system to implement and replacing it with POSIX system calls is like ripping out the seats and replacing them with a trailer hook up. There's nothing wrong with being able to attach large trailers to your vehicle, but the type of vehicle you're converting may be better off without your alterations.

The JVM contains instructions such as instanceof and various ways to invoke a method that mirror the OOP approach of Java. Garbage collection instructions are also extensively used, of course, but they're not as OOP specific.

Unlike WASI, WASIX adds open()/read()/write()/close() to WASI. It also adds fork(), exec(), and wait(). With modern web APIs (such as the filesystem API) many of these can be added without any virtual implementations, but WASI and WASIX are also targetting other use cases. One use case being pushed by a lot of WASM companies is for WASM to replace Docker containers in a Kubernetes cluster, for example.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by kelp on Tuesday May 30, 2023 @04:17PM (#36130130)
WASM won't be able to get any real level of adoption if you have to specifically write all your code to target it, which I think is what would happen if the sandbox is too restrictive.

If you can trivially move existing code to run in a WASM VM you get the benefits of isolation and a convenient artifact to move around for deployment and scheduling.

I think the history of successful platforms are ones that still supported the old way of doing things, while enabling a new and better way. Of course that comes with lots of tradeoffs that are often hard to stomach.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by jeroenhd on Tuesday May 30, 2023 @05:09PM (#36130840)
I agree that "WASM as a generic target platform" is the best way for WASM to gain popularity and actually get used.

However, that would make it end up as "Java but different". That's not a bad thing, there's absolutely nothing wrong with Java as a technological concept!

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by zdragnar on Tuesday May 30, 2023 @01:40PM (#36127903)
> A bus and a cargo truck are not the same

The redneck engineer in me disagrees.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by tyingq on Tuesday May 30, 2023 @01:47PM (#36128001)
I see your point for how things are now, but the WASM roadmap and proposals do have several things on it that take it into territory that's closer to the JVM.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Tuesday May 30, 2023 @03:19PM (#36129267)
Here is the thing, there isn't only the JVM, plenty of examples since late 1950's.

Arguing that WASM isn't JVM as defence, while forgetting computing history isn't great either.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by vinkelhake on Tuesday May 30, 2023 @05:42PM (#36131307)
What's forgotten? Do you have any favorite bytecodes from the 50's that you want resurrected?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pjmlp on Wednesday May 31, 2023 @12:42AM (#36134543)
Interlisp-D for one would be nice, I guess.

And it isn't from the 1950's, it is since then.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by vbezhenar on Tuesday May 30, 2023 @01:35PM (#36127823)
Yes, it is "JVM reimagined". It has very little with browsers, though.

IMO this is wrong direction.

Better direction is to move into browser. Add arch/wasm to linux kernel. Compile it to wasm. Compile systemd to wasm, glibc or musl, with docker in the end. Now you can run linux in your browser. You could run it before, but this way makes it as native to browser as possible. Probably will be very fast and suitable for work.

Now with docker ask people to compile their software to wasm. Now you can run postgres and kubernetes in your Chrome tab. All you need is some escape hatch for network ingress/egress which is not hard to implement.

May be implement virtio-gpu with webgpu and you can easily run full-fledged Gnome in your browser tab. Not hard to sync your disk to S3, so you can open this VM from any computer and run it locally.

Basically VM in your browser, cross-platform, cross-architectured.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by laxd on Tuesday May 30, 2023 @02:09PM (#36128319)
> Now you can run postgres and kubernetes in your Chrome tab.

This is what the world has come to.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by paulddraper on Tuesday May 30, 2023 @07:27PM (#36132560)
Sooo.....a VM?
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by tokera on Wednesday May 31, 2023 @01:19AM (#36134728)
For sure, VM without the bloat
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by pookha on Tuesday May 30, 2023 @02:13PM (#36128367)
I think it's more about streamlining application deployments and removing the containerization hurdle...The dream seems to be a universal byte-code (WASM) vm that would open the door so that Python, Node, Java 58LTS, Rust, C or freaky Lua scripts could run on the same runtime -- easily -- without container wrappers that each have to be secured (patches) and with a startup penalty.
Re:WASIX, the Superset of WASI Supporting Threads, Processes... by kelp on Tuesday May 30, 2023 @04:11PM (#36130024)
I think server side WASM has the potential to be the next thing after containers.

And yes, lots of echoes of Java's "write once run anywhere" but as lots of people have pointed out, wasm is language agnostic, and many languages have support for it.

Since I've been web applications and distributed systems, the evolution has been something like this.

1. Copy files around, into the web or application servers directory. This was simple but isolation, repeatability and testability was hard. The application dependencies were directly tied to the host, so you had to be very careful about your upgrades breaking applications. The lack of isolation is not suitable for multi-tenant environments for security and capacity planning reasons. It's pretty hard to run multiple-applications (1)

2. Things like bundler, and other language specific tools that let you bundle your application dependencies together. Avoids some of the host OS related upgrade issues, but again, no real isolation.

3. VMs. The whole cloud industry started on this. You get true isolation of your whole application at the cost of complexity and weight. Scheduling new VMs is not a fast process because you're copying around or at least booting a whole OS. You still have to manage OS images. There is also generally a tax on memory that you have to pay, so you waste some resources with VMs to get the isolation. Amazon invested in Nitro to avoid paying a lot of this tax.

4. Containers. Lighter than VMs, good enough isolation in a lot of cases, especially inside of an organization. Lower tax than VMs. More testable. But containers are still fairly heavy, startup time can be slowish. So you have some limitations on how fast you can scale up and down in response to load. Also isolation isn't good enough for some workloads. So we see things like firecracker VMs being used to improve isolation.

5. Wasm on the server side. Much lighter than containers. Less memory overhead, way less startup time. Probably faster startup time than even firecracker. So for lambda like workloads you could could have a lot better cold start latency. You probably have good enough isolation that you don't need to resort to things like firecracker to isolate customer workloads. Because of the fast startup time you could probably pack your long tail of workloads even tighter to get better effective utilization out of your server infrastructure.

(1) In the early 00s I worked at a place where we wrote our own simple process supervisor and used some tricks with LD_LIBRARY_PATH to let us bundle all application dependencies with the application. So you could run multiple application that needed different libraries on the same host, and upgrade your host without as much worry about host OS library changes breaking our applications. It was a kind of proto-container, without all the other isolation cgroups give you.

Re:WASIX, the Superset of WASI Supporting Threads, Processes... by preseinger on Tuesday May 30, 2023 @04:26PM (#36130263)
wasm targets more than just browsers