Linux Kernel Running In JavaScript Emulator With Graphics and Network Support 177
New submitter warmflatsprite writes "It seems that there have been a rash of JavaScript virtual machines running Linux lately (or maybe I just travel in really weird circles). However until now none of them had network support, so they weren't too terribly useful. Sebastian Macke's jor1k project uses asm.js to produce a very fast emulation of the OpenCores OpenRISC processor (or1k) along with a HTML5 canvas framebuffer for graphics support. Recently Ben Burns contributed an emulated OpenCores ethmac ethernet adapter to the project. This sends ethernet frames to a gateway server via websocket where they are switched and/or piped into TAP virtual ethernet adapter. With this you can build whatever kind of network appliance you'd like for the myriad of fast, sandboxed VMs running in your users' browsers. For the live demo all VMs connect to a single private LAN (subnet 10.5.0.0/16). The websocket gateway also NATs traffic from that LAN out to the open Internet."
Re:So...? (Score:3, Interesting)
Make firefox faster?
Simpler BotNet design?
It was likely a learning project, and is kind of cool. But it is more reason to run NoScript and similar.
Even runs on iPhone 5s... (Score:4, Interesting)
The most incredible thing is the speed at which it runs: 11.5 MIPS.
My desktop dual-core Xeon W3503@2.40Ghz barely manages 40 MIPS in Chrome.
The iPhone 5s is crazy fast by most standards
Re:is javascript faster than java? (Score:5, Interesting)
Any nerds left on /.? (Score:5, Interesting)
It's amazing to me that "tech for the sake of tech" posts like this elicit much the same responses I would expect from a non-nerdy audience. At what point did slashdotters become mostly a group of curmudgeonly old-men who care only about what use can be made of new things and who find NO INTEREST what-so-ever in new and different ideas?
THIS is why it takes that ex-jock-turned-business man to make money on technology. Somebody who isn't an old-fart slashdotter who "ho-hum"s everything new. This community is SUCH a disappointment.
First post! (Score:5, Interesting)
From my OpenRISC ORK Javascript Emulator Running With Network Support
i.imgur.com/zJPsjCT.png
Re:So...? (Score:5, Interesting)
I wonder how useful it would be for security sensitive applications. For example, even though it sounds goofy to run a Web browser in a Linux kernel running in a window, the difficulity for malware to get out of rings of context (including multiple instruction sets) would be enormous. Not impossible, but highly unlikely.
Something like this would provide a decent defense against browser-based (or browser add-ons) attacks (which is a significant vector for malware these days.)
Re:is javascript faster than java? (Score:4, Interesting)
JavaScript != Java indeed. I'm still amazed at the silliness of the choice.
I've actually seen a newbie developer paste a snippet of one into the other... Finally I had an occasion to use the phrase "that's not even wrong" in an actual conversation.
The dev didn't last at our company.
Re:So...? (Score:5, Interesting)
I am a programmer focused on simulations/emulations and performance. I was also interested in learning the internals of how a computer nowadays works. The x86 CPU is way to compilcated. You lose the clear sight for stupid details like the A20 gate. The OpenRISC project is perfect. It is a CPU with a very easy and clear CPU. Nothing historic. It has even some similarities with byte code, which makes it very fast if you emulate it properly. I optimized especially for running Linux violating the specification a bit.
The whole CPU with MMU fits in around 1000 lines of code. During that day I never expected to get that far. Now with all three cores and devices it needs around 7000 lines of code.
I have a list of useful things you can do with it:
1. Use it as an education system of the Linux system or other tools. For example you could write a git tutorial with live examples.
2. This emulator provides an alternative way to port old software to run on modern systems. In direct comparison to the project Emscripten it is slow, but the porting could be much easier. For terminal applications probably no porting is neccessary at all (e. g. Frotz).
3. The emulated OpenRISC CPU is very easy and contains around 1000 lines of code. So it is the perfect example to learn how emulation works.
4. With network support it allows you to access other computers within the Web Browser providing ready to use tools. (Even an encrypted chat is possible if you run the sshd daemon)
5. Use it as a speedtest for Javascript engines.
6. It is an advertisement for the OpenRISC project.
You can also read the motivation of Ben Burns in his Blog: http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-support.html [benjamincburns.com]
And I have to admit that I did the wayland support last time only to get some news.
Re:is javascript faster than java? (Score:4, Interesting)
I'm puzzled how one makes it "fast". When my highly active programs run in a browser they tend to glitch and halt after a while if they have been doing lots and lots of quick object instantiation and destruction.
You've almost figured it out!
Recycle your objects. Enjoy instant performance improvements. (While this is not just true for JavaScript, it's obviously the advice you need.)
Oh, and try learning the language. It's not like Java and C#. If you try to treat it that way, you'll end up writing crap. You can break yourself out of that easily enough by working through The Little Schemer in JS instead of Scheme.
Re:So...? (Score:2, Interesting)
A nerd rides up to his friend on a shiny new bike.
His friend asks, "where'd you get the bicycle?"
The first nerd relates, "a beautiful woman came up to me, dropped the bike to the ground, tore off her clothes and said "take anything you want!", so I took the bike."
His friend insightfully notes, "yeah, the clothes probably wouldn't fit you."