What does HackerNews think of v86?
x86 virtualization in your browser, recompiling x86 to wasm on the fly
As an engineer I'm 10% fascinated and 90% horrified by the sheer complexity.
Awesome work! The whole aesthetic is well done.
https://github.com/ffmpegwasm/ffmpeg.wasm
Another is the SQLite WASM project:
https://sqlite.org/wasm/doc/trunk/index.md
Also v86 for x86 machine virtualization in the web browser:
A fun project is WASM-4, for building retro-style games:
Possibly more interesting projects to be found here:
I came across this site sometime ago - but didn't bookmark it.
Just a few hours ago - I found some similar resources and wished I'd bookmarked this list.
And here it is!
Anyway, here's my list on the same theme: Systems running in a browser.
https://simone.computer/#/webdesktops
https://github.com/copy/v86
https://github.com/syxanash/awesome-web-desktops
https://en.wikipedia.org/wiki/Web_desktop
https://github.com/zriyansh/awesome-os
https://github.com/jeffpar/pcjs
https://github.com/whscullin/apple2js
https://github.com/felixrieseberg/macintosh.js
https://github.com/felixrieseberg/windows95/
https://github.com/1j01/98
Thanks for supplementing my notes stranger!I like making jokes with coworkers about implementing this or that bit of infra with WASM-based tools mostly to get a rise out of them but each time I make the joke I look into some of the tools or projects and the balance of joke to "I'm actually serious" shifts a little bit to the right.
All of the heavy lifting here is done by v86: https://github.com/copy/v86
v86 can be used for a number of things besides Postgres - things like Repls or other entire applications are definitely achievable.
Networking between Postgres and the internet was a lot of work, and Mark came up with a neat solution detailed in the blog post. This solution can be used for any other application. If you're looking to run a native application in the browser using v86, the repo & blog post is a good launching pad.
Making Postgres Wasm helped:
- v86[0] to find a new bug
- Providing a great deep-dive article that will trigger new ideas in the future
- Showcase the possibilities of Wasm and how you can overcome the current challenges
I really appreciate these projects are OSS :)
Congratulations for the project!
We use similar techniques to power Webvm[1], an X86 Virtual Machine that runs linux programs in the browser.
A proper Wasm JIT API in JavaScript would be even better of course, but as the article says, cool things are already possible right now.
I expect to see more projects doing Wasm just-in-time compilation in the future (I believe that V86[2] also already does it)
[1]: https://webvm.io/
This might be a good start:
https://copy.sh/v86/?profile=windows98
The emulation has load/save state (.bin file), and apparently includes a floppy disk controller.
It likely isn't suited for compiling big c programs, but I think one can get far with preparing a few shared libraries and Tiny C Compiler or similar.
[1] https://github.com/copy/v86
[2] https://copy.sh/v86/?profile=buildroot
[3] https://github.com/copy/v86/blob/master/examples/lua.html
I would love to see if we can have something similar that doesn't require JS at all, so we can execute x86 programs server-side just using Wasm translation (hi Wasmer).
Here's another interesting project I found recently that I think fits as well on the asm2wasm translation mechanism: https://github.com/copy/v86/
Not sure what the mac versions are using though.
(Edit: sadly, I'm only half-joking. I was thinking about how fun it would be to extend this so as to bridge the host and the guest via e.g. a socket, so that I could get notifications about UI events inside the machine on the host, which would give me Visual Basic 6's UI builder and all the greatness of a 21st century machine, so that I could finally whip up an UI without yelling profanities at the CSS reference and in less than umpteen hours of tinkering with stuff that clearly just wasn't built for this. Thing is, halfway through, I really began thinking this might make sense a little and that depresses me. /done editing)
That being said, if anyone's curious what else can be achieved in this manner, there's a bunch of nice demos here: https://github.com/copy/v86 .
The latter one even has complete network support.
https://bokub.github.io/git-history-editor/
In the future, I'd like to extend the shell tool to have a nice "edit mode" that runs git rebase underneath. I haven't thought through how to deal with merge conflicts, though.
Being able to run the tutorials online would be ideal, but that will require a full-fledged OS to run the project. That could be done server-side with a sandboxed OS ($$$) or, intriguingly, perhaps it could be done entirely client-side using an in-browser Linux emulator:
There's even a demo with Linux 3. [1]
[0] https://github.com/copy/v86 [1] https://copy.sh/v86/?profile=linux3
The code is here: https://github.com/copy/v86
The CPU code is pretty cool https://github.com/copy/v86/blob/master/src/cpu.js
you can check a small benchmark here: https://github.com/s-macke/jor1k/wiki/Benchmark-with-other-e...
There are much cleaner emulators to study in JS: for the x86 family, I recommend v86 https://github.com/copy/v86
For general emulation, RISC architectures are much simpler to understand, jor1k https://github.com/s-macke/jor1k performs very well, and can simulate the OpenRISC 1000 architecture as well as RISC-V (32bit only). There's also the 64bit ANGEL emulator for RISC-V http://riscv.org/angel/
All of these are probably more useful pedagogically than my hand-unrolled jslinux repo, unless you're particularly interested in that emulator.
I would love to see such js emulators one-day used in operating-systems courses, allowing one to step through bootloaders and kernel init code to get a real feel for the code, along with other dynamic illustrations of the machine state and various kernel data structures on the same page. If I weren't devoted full-time to synthetic biology I might be tempted to try such a thing myself!