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."
Bored with layers of indirection game now. (Score:3, Insightful)
Can we go back to trying to target for time+space efficiency rather than buzzwords?
Re: (Score:1)
They are, this is the most efficient Linux kernel running in JavaScript, through WINE, on Red Hat, in a VMware image, on a tablet running KitKat flavored Android (... a Javaclone on an ARM).
Re: (Score:2)
That version is coming. It's very buggy though and will take another 2 years to get to alpha. In the mean time enjoy this "working well enough for what the developer wanted" version.
Yes, network support. (Score:5, Insightful)
Re:Yes, network support. (Score:4, Funny)
2014 will be the year of the Javascript emulated Linux Desktop
Re:Yes, network support. (Score:4, Funny)
Just as long as we get a year of the Linux desktop, I'm willing to settle for it at this point.
Re: (Score:2)
Beowulf (Score:2)
Imagine a Beowulf cluster of these! It would be the slowest, worst cluster ever!
Re: (Score:1)
came here to see this. thanks.
Yeah, but does it run... (Score:4, Funny)
..er, forget it.
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: (Score:3)
"my desktop dual core"
isnt multiple cores irrelevant in the single threaded javascript environment?
Re: (Score:2)
You're right. The task manager was hovering around 100%, and but I forgot there was another chrome window running in the background
Re: (Score:2)
Re: (Score:3)
It depends.
Once you're in steady state, and if you don't use workers and don't use the new parallel processing primitives people are proposing for JS, you're right.
But during JIT warmup, and any time you have to JIT a new function or new codepath it matters because on multicore hardware you can do background compilation.
Re: (Score:1)
Yes, the 5s is incredibly fast. With a Geekbench score of 2523, it's faster than a 2011 Mac Mini (which were not slow machines by any means). It matches my last workhorse, a 17" MacBook Pro, which clocked in at 2524.
Incidentally, it doesn't take a weatherman to know which way the wind blows. Intel recently started up ARM production for the first time ever, and Apple has been referring to the A7 as "desktop class." It's only a matter of time before they ship the first ARM MacBook.
All of this is relevant to J
Re: (Score:1)
"Intel recently started up ARM production for the first time ever, "
Nope - see http://en.wikipedia.org/wiki/XScale
I still have some Palm Zire 71/72, and Windows CE/Mobile devices with Intel ARM CPU's.
Re: (Score:3)
Yes, the 5s is incredibly fast. With a Geekbench score of 2523, it's faster than a 2011 Mac Mini (which were not slow machines by any means).
Which 2011 mac mini are you talking about?
http://browser.primatelabs.com/geekbench2/search?page=2&q=mac+mini+2011&utf8=%E2%9C%93 [primatelabs.com]
The scores for a 2011 macbook range from 5500 to 9500 depending on the model.
So... less than half as fast as a low end computer from 2 years ago? Ok... I'll buy that.
And the 5S is in the same ballpark as a Galaxy Note 3, Sony Xperia Z1
Re: (Score:2)
But my MacBook Pro 17 was a top of the line machine 4 years ago
Erm... again I'm seeing lots of scores of 4000+ for a "2009 MBP 17" on the geekbench search; vs ~2200 for a 5S, still very nearly double.
And early 2009 is a good 4.5 years before the 5S releases.
I share your enthusiasm, but the numbers aren't quite there.
It's still pretty impressive that the 5s can match it
Not quite match it, but the iphone 6 very well might.
Although, performance on the desktop cpu has stalled.
The Ivy Bridge stuff vs Haswell i
Re: (Score:2)
I just looked up what exact model my MBP was. It was a MC226LL/A, running a Intel Core 2 Duo T9600 at 2.8 GHz.
Thanks for the detail and the link.
I've sorted out the confusion. The weird thing seems to be whether its geekbench 2 or 3. The T9600 mbp benchmarks over 3900+ on geekbench 2 vs the iphone at 2200; but on geekbench 3 the scores are much closer.
I wonder what that means.
That's why I think it's inevitable that we'll get an ARM-based MacBook at some point.
Yay. OSX RT, just what everybody wants.
Sadly it
Turtles all the way down (Score:4, Insightful)
Re: (Score:1)
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.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
That's true - technically by numbers of viewers the trolls may be outnumbered. But Slashdot's "value add" has always been the rich discussion and comment system. And in that arena the trolls are definitely more active and visible.
I think it's time Slashdot editors started doing more active culling of posts that will very obviously have no benefit. Give an editor unlimited mod points and mod down off-topic, stupid, etc. posts. The ones that derail any decent conversation right out of the gate *all the f'
Re: (Score:2)
And now I un-did my moderations by posting non-AC. *sigh*
First post! (Score:5, Interesting)
From my OpenRISC ORK Javascript Emulator Running With Network Support
i.imgur.com/zJPsjCT.png
Re: (Score:3)
Hope you realized you just sent your Slashdot password through some dude's hacked together relay server in, most likely, clear text... Also there are a bunch of other Slashdotters on the same virtual subnet with full root access to theirs, yours, and everyone else's virtual machine on that very subnet.
Very cool post, but you may want to change your password now.
and ...
Just don't do any online banking that way. ;-)
Re: (Score:2)
Yeah, I thought about that. I don't really care about my slashdot login. :)
Rich applications (Score:2)
Wonderful now that I can finally run a full operating system in a browser, I can finally deliver a rich client server experience in my web-based applications :-)
Re: (Score:2)
Re: (Score:3)
I've found it to be faster than running Linux directly on hardware under certain circumstances.
All joking aside... (Score:2)
There are many times when I need to do remote admin on a machine from a location where I don't have SSH available. Currently that usually involves some type of hacky browser-based terminal emulator. Actually running a Linux based OS in the browser would be perfect for such occasions, assuming I'm someplace where making outbound port 22 connections isn't a problem.
where do you not have ssh available? (Score:2)
Considering that most smartphones will happily run a terminal program...and you can get bootable linux on a usb stick or a whole linux computer on an HDMI plug.
Re: (Score:2)
Considering that most smartphones will happily run a terminal program...and you can get bootable linux on a usb stick or a whole linux computer on an HDMI plug.
I'm talking about a device where installing additional software or plugging in a physical device that I probably don't have with me anyway is either not possible or not desirable.
Re: (Score:2)
Yes some web based SSH clients are better than others, but I assume the response time would be much quicker than emulating an entire OS as running an SSH client within it.
Re: (Score:2)
Yes some web based SSH clients are better than others, but I assume the response time would be much quicker than emulating an entire OS as running an SSH client within it.
Did you try the demo? I was quite surprised at how snappy it was. Point taken that the definition of "hacky" is subjective :)
Re: (Score:2)
If you have web access, then you can download PuTTY. Much simpler/easier than waiting for an OS to load in your browser ... just to run "ssh".
Re: (Score:2)
If you have web access, then you can download PuTTY. Much simpler/easier than waiting for an OS to load in your browser ... just to run "ssh".
The wait time of the demo really wasn't that unreasonable. Installing Putty isn't possible if I'm on a platform it doesn't support or on a device where I can't install or run additional software.
Re: (Score:2)
Let me see if I understand you correctly. You have no problems handing over your SSL credentials to a web site so you can do remote admin? Does your employer know you do this?
I'm not sure which "employer" you're referring to; these are my own websites and yes I understand the security implications and take appropriate precautions.
Prelude to a new wave of drive by malware? (Score:2)
Re: (Score:2)
http://search.cert.org/search?client=default_frontend&site=default_collection&output=xml_no_dtd&proxystylesheet=default_frontend&ie=UTF-8&oe=UTF-8&as_q=javascript+&num=10&btnG=Search&as_epq=&as_oq=exploit&as_eq=&lr=&as_ft=i&as_filetype=&as_occt=any&as_dt=i&as_sitesearch [cert.org]
need help with WINE (Score:3)
OS Prototyping engine (Score:2)
ob (Score:2)
And with it they cure cancer, solve world hunger and make perfect soufflé?
Re: (Score:3, Informative)
What does one use this for?
Self-achievement? Learning? To get chicks?
Re: (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.
Re: (Score:3)
What does one use this for?
To get chicks?
Unlikely -- doesn't work in Internet Explorer.
Re: (Score:3)
Re: (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."
Re: (Score:1)
To understand that all reality is but a virtual machine running on a virtual machine.
God is trying to make us understand reality through the emulation of the OpenCores ethmac ethernet adapter.
He isn't very happy with the results. He is thinking that everything was simpler when he made his points through floods and flaming sword wielding archangels.
Re: (Score:2)
Yeah, he was happier back in those days. Until His Mom took away those toys and told Him to clean up His room. He's been in the sulking place ever since. Now he just want to throw things at the walls, and shove those who want to friend him too much under the bus.
Mom's pretty cool, though. Cakes and ale parties just about anytime you ask for one, and if you promise not to make a mess, She'll get out the fingerpaints or anything else you want to play with, and even help you through the tough spots, like when
Re: (Score:2)
I'm not sure where this analogy is going...
Re: (Score:1)
Re: (Score:3)
Idunno. Can you even call them runtime errors in a setup like this?
This is using a Linux VM, emulated in Javascript, in a sandbox, inside your browser. I don't think the thing could possibly run. Or even walk. I think the fastest it could go would be a slow crawl.
Re: (Score:2)
It runs. It's not fast, no, but it runs fast enough to actually play around with.
Re:So...? (Score:5, Funny)
As a component of a Beowulf cluster, obviously.
Re: (Score:2, Informative)
All we need now is JS acceleration built in to cpus.
Yo dawg, I heard you like VMs so..
Re:So...? (Score:5, Funny)
It lets you be a VPS provider, using nothing other than a copy of Chromium. No need for fancy processors and virtualizing instructions, no hypervisors, no containers, whatever.
Scales beautifully: Got a new customer? Just open another tab!
Re: (Score:1)
Hahaha that's awesome. Genuine LOL here.
Thanks,
-l
Re: (Score:2)
Got a new customer? Just open another tab!
Based on your description, I believe that I've already seen prior art in restaurants.
Re:So...? (Score:5, Funny)
What does one use this for?
The same thing we do every night, Pinky - try to take over the world!
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: (Score:2)
This is a cool project. Thank you for working on it.
-l
Re: (Score:2)
+1 - very cool project.
Re: (Score:1)
DUPE? (Score:2)
Dupe, or maybe just an update to this:
http://tech.slashdot.org/story/13/10/12/1819231/javascript-based-openrisc-emulator-can-run-linux-gcc-wayland [slashdot.org]
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:5, Informative)
The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. The final choice of name caused confusion, giving the impression that the language was a spin-off of the Java programming language, and the choice has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web programming language.
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:is javascript faster than java? (Score:4, Insightful)
javascript != java
But you can still ask the question whether JavaScript is faster than Java.
Re: (Score:3)
You can ask a lot of questions, but that doesn't mean they're good questions.
Re: (Score:2)
Re: (Score:3)
Comparing Java and JavaScript is like comparing a bicycle and a space shuttle. Sure, they're vaguely related as means of transportation but are otherwise completely unrelated.
Re: (Score:3)
Someone here had a sig that was "Java is to Javascript as Car is to Carpet".
Re: (Score:2)
.... only if you live in a magical fairy land.
Re: (Score:2)
We are talking about a browser running on Linux running on a browser that's running on Linux...
Re: (Score:3)
> Comparing Java and JavaScript is like comparing a bicycle and a space shuttle.
which one is the space shuttle?
Your comparison comparison is like comparing monkeys with the Eiffel tower.
Re: (Score:2)
Re:is javascript faster than java? (Score:5, Interesting)
Re: (Score:2, Insightful)
Um, Javascript can also have fantastic performance if you "use it correctly". Neither is particularly fantastic if you use like like an average programmer, though.
Re: (Score:3)
Depends on where the heavy lifting is.
If you've got a JavaScript that implements web SQL and web GL, well, those are implemented in low-level languages and you're just going to call them from JavaScript. If that happens to be where the bulk of the work is for a given program, you might get better performance out of JavaScript than Java.
(The devil is in the details. I do not know the details in this specific case.)
Re: (Score:3)
I'm just learning javascript. 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. My guess was this was some memory leak or deferred garbage collection. I see inconsistent results across browsers.
I'm enjoying learinging at how easy it makes doing graphics in a browser window. however It's a weird mishmash of incomplete grammars and high level c
Re: (Score:3)
Lots of small quick memory allocations/releases is generally a performance killer regardless of language or environment - if you use a garbage collecting environment it tends to be even worse, but regardless you're asking a memory manager that has to be able to deal with memory requests of all sorts of sizes and use-cases, to deal with an extreme special case that demands near-maximum amount of effort to mitigate memory fragmentation. In almost all cases your performance and stability will increase substan
Re: (Score:2)
Actually garbage collecting environments like the JVM deal with lots of small object creation on the heap much faster than compiled C++ for example.
http://programmers.stackexchange.com/questions/208656/java-heap-allocation-faster-than-c [stackexchange.com]
Re: (Score:2)
NOTE: may not apply to Javascript - but to say that "garbage collected enviornments" perform worse in this instance is just wrong. Though some may others may not.
Re: (Score:2)
Notice I said *tends*. Java has had a couple decades of optimization to it's memory manager, so I'm not surprised it's finally surpassing the rather simplistic default C++ implementations.
On the other hand a specialized memory manager tuned to the task at hand will of course tend to completely trump any of the alternatives, which was my main point, and depending on the demands it can be fairly simple to implement as well, provided you understand at least the basics of the underlying memory manager you're b
Re: (Score:2)
The JVM and C# garbage VMs *are* specialized memory managers. That's why they do work so well. You just get them "for free" with the environment.
Re: (Score:2)
No, they aren't, they're general purpose memory managers. They handle every memory-allocation request, large or small, short-lived or long, all through the same interface with minimal apriori information, and that flexibility comes at a price.
If I know I'm going to be repeatedly allocating and deallocating millions of 12-byte objects per second I will likely get much better performance allocating a single sufficiently large array of objects and reusing them (i.e. make my own domain-specific memory manager)
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.
recylcing objects for speed and memory savings (Score:3)
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.
How one does that is not obvious to me. let's take an example. Suppose I create a function like this:
var recylceObj = function( oldObj, newAttitributes) {
for (var i in newAtritutes) {
oldObj[i] = newAttributes[i];
};
}
var foo = recycleObj( oldObj, { x:1, y:2, z:3} );
so superficially I just reused an old memory allocated object oldObj by ov
Re: (Score:2)
Try again. You'll get there.
Re: (Score:2)
*clue needed
Re: (Score:2)
Do a search for javascript object pool. You'll get lots of stuff.
Be careful with what you find. JS is (apparently) the world most misunderstood language. There's a lot of nonsense and bad examples out there. On "big names", stick with Doug Crockford if you can. Avoid reading anything written by Resig; to call his code 'abysmal' is far too generous.
Re: (Score:3)
it can run anything, inside it's browser vm it's quite "complete" computing platform so why not.
just not anything in parallel ;) so you have to be sneaky...
and java can run in parallel and is superior in just about every way but due to politics of days past they integrated javascript and not java as the language the browser has facilities to run.
on both of them it's what you code and how that make them choke, try to do something that does things slowly and it will do them slowly.
using a websocket is kind of
Re: (Score:2)
java can run in parallel and is superior in just about every way
Wow, no. JS is pretty obviously the more sophisticated language.
Re: (Score:1)
Re: (Score:2)
Or you could just write a JVM in Javascript
Re: (Score:2)
oh yes, Windows is much more complex, needing about twice the resources and memory to get the same job done as a Linux or BSD, in between siezeups needing a reboot. truly a powerhouse.