News for hackers. Stuff that matters.
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @02:55PM (#30168267)
Hello HN, author of the post here, happy to answer questions.
Re:WebVM: Server-less x86 virtual machines in the browser by brian_herman on Tuesday February 01, 2022 @03:19PM (#30168616)
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @03:53PM (#30169113)
Perf. Our JIT is extremely advanced. Of course different workloads will behave differently, but you are welcome to try multiple payloads and see for yourselves.
Re:WebVM: Server-less x86 virtual machines in the browser by mhh__ on Tuesday February 01, 2022 @11:05PM (#30173573)
What constitutes advanced?
Re:WebVM: Server-less x86 virtual machines in the browser by easrng on Tuesday February 01, 2022 @03:21PM (#30168647)
Re:WebVM: Server-less x86 virtual machines in the browser by remisharrock on Tuesday February 01, 2022 @03:42PM (#30168966)
And jor1k (JavaScript openrisc processor emulator) : well, they emulate processors (x86, openrisc..) in JavaScript while WebVM execute (transpiled?) code in webassembly
Re:WebVM: Server-less x86 virtual machines in the browser by g3 on Tuesday February 01, 2022 @07:14PM (#30171724)
v86 also recompiles machine code to web assembly. The main difference is that v86 is a hobby project (of which I'm the original author, by the way), with much fewer contributors and no (known) commercial users, and is much less sophisticated than this project. On the other hand, v86 is open source, so you could make it sophisticated if you wanted to :-)

I'm not sure what exactly cheerps is used for; v86 is mostly used to demo operating systems (mostly hobby and vintage). We recently got SerenityOS to run: http://copy.sh/v86/?profile=serenity

Re:WebVM: Server-less x86 virtual machines in the browser by Klasiaster on Tuesday February 01, 2022 @04:06PM (#30169262)
So, this is a reimplementation of the Linux ABI and no Linux kernel source is involved, right?
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @04:15PM (#30169406)
That's correct.
Re:WebVM: Server-less x86 virtual machines in the browser by Klasiaster on Tuesday February 01, 2022 @04:28PM (#30169583)
Have you tried compiling Linux as User Mode Linux with emscripten? I imagine something like this https://github.com/nabla-containers/nabla-linux would run on wasm, too?
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @04:34PM (#30169678)
Well, User Mode Linux would still require an underlying Linux ABI, for example mmap to implement pagination. With sufficient work it might be possible to actually run UM Linux _on top_ of CheerpX / WebVM.

Implementing the Linux ABI ourselves gives us the opportunity of a tighter integration with the Web platform anyway.

Re:WebVM: Server-less x86 virtual machines in the browser by arturventura on Tuesday February 01, 2022 @05:19PM (#30170312)
Hey dude, I've been screwing around implementing plan9 semantics in a OS like system for the browser (https://github.com/intigos/possimpible). I'm interested in using a x86 emulator inside a webwoker that I'm using for processes so I can run x86 code. How hard is something like this? Can you give me some pointers on how to start working on this? Thanks!
Re:WebVM: Server-less x86 virtual machines in the browser by btdmaster on Tuesday February 01, 2022 @05:02PM (#30170095)
It seems to not work with my eager block settings. It works with a fresh Firefox profile though, so it's not clear what the issue exactly is though. I know for sure that the ext2 is never actually downloaded (0 byte response) and when I try to check anything in DevTools cxcore.wasm triggers a pause on debugger statement, which spikes the CPU.

Any chance there could be a version with all the assets in one thing (say, GitHub Pages)?

Re:WebVM: Server-less x86 virtual machines in the browser by easrng on Tuesday February 01, 2022 @03:35PM (#30168856)
Is there support for loopback networking (for IPC)? Is there a way to translate HTTP(S) requests to `fetch` requests? How difficult would it be to port a Go app that uses https://github.com/pion/webrtc to use the browser's native WebRTC?
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @04:10PM (#30169326)
HTTP request could be intercepted, but due to CORS they would most likely not succeed. I have not studied the WebRTC protocol in detail but it might be possible.
Re:WebVM: Server-less x86 virtual machines in the browser by bonzini on Wednesday February 02, 2022 @05:39AM (#30175914)
What performance bottlenecks are there that can still be improved?

Right now I see a ~6x slowdown on small-code benchmarks like sieve, but it goes up to 50x or more for large code like GCC. For QEMU it's roughly 1.6x and 2-3x respectively, so it seems like your JIT is slower than QEMU's.

Re:WebVM: Server-less x86 virtual machines in the browser by PeterisP on Tuesday February 01, 2022 @09:38PM (#30172915)
Is this tech a reasonable way for cross-platform emulation, e.g. a x86 VM running on a browser on ARM hardware like the new Apple chips?

In essence, for this approach, would the x86-on-x86 performance hit be similar or very different than the x86-on-ARM performance hit?

Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Wednesday February 02, 2022 @03:37AM (#30175198)
The actual host hardware does not matter, neither in terms of support or performance, theoretically. We currently optimize the codegen for Chrome/V8 on x86.
Re:WebVM: Server-less x86 virtual machines in the browser by xmly on Tuesday February 01, 2022 @03:59PM (#30169176)
How about the network stack? Is the VM can talk with other VMs from other browsers.
Re:WebVM: Server-less x86 virtual machines in the browser by apignotti on Tuesday February 01, 2022 @04:06PM (#30169260)
Not in the current implementation, but absolutely possible with WebRTC. We have done something equivalent some time ago: https://medium.com/p/29fbbc62c5ca
Re:WebVM: Server-less x86 virtual machines in the browser by tlarkworthy on Tuesday February 01, 2022 @05:53PM (#30170766)
I have REDIS driver working in web using websockify bridges (and there are a few other options)

https://observablehq.com/@tomlarkworthy/redis

Re:WebVM: Server-less x86 virtual machines in the browser by remisharrock on Tuesday February 01, 2022 @03:46PM (#30169024)
Will you open source your code one day and if no, why not?
Re:WebVM: Server-less x86 virtual machines in the browser by thekozmo on Tuesday February 01, 2022 @05:13PM (#30170252)
Impressive stuff! Worth to try to run the OSv unikernel (one of my babies) in it.
Re:WebVM: Server-less x86 virtual machines in the browser by habitue on Tuesday February 01, 2022 @03:41PM (#30168942)
Can you run containers in webvm?