Slashdot Mirror


Linux Kernel Running In JavaScript Emulator With Graphics and Network Support

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."

127 of 177 comments (clear)

  1. Bored with layers of indirection game now. by Joining+Yet+Again · · Score: 2, Insightful

    Can we go back to trying to target for time+space efficiency rather than buzzwords?

    1. Re:Bored with layers of indirection game now. by Anonymous Coward · · 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).

    2. Re:Bored with layers of indirection game now. by Atzanteol · · Score: 1

      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.

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
  2. Re:So...? by sirber · · Score: 3, Informative

    What does one use this for?

    Self-achievement? Learning? To get chicks?

    --
    Be or ben't
  3. Re:is javascript faster than java? by DragonDru · · Score: 5, Informative
    javascript != java http://en.wikipedia.org/wiki/JavaScript

    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.

    --
    20 characters max for the password? How will I use my favorite poems as passwords?
  4. Re:So...? by DragonDru · · Score: 3, Interesting

    Infect Windows with Linux Viruses?
    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.

    --
    20 characters max for the password? How will I use my favorite poems as passwords?
  5. Yes, network support. by ArbitraryName · · Score: 5, Insightful

    A lack of network support was what was holding back a JavaScript VM running Linux from being useful. No other reason whatsoever.

    1. Re:Yes, network support. by Anonymous Coward · · Score: 4, Funny

      2014 will be the year of the Javascript emulated Linux Desktop

    2. Re:Yes, network support. by Trepidity · · Score: 3, Funny

      Just as long as we get a year of the Linux desktop, I'm willing to settle for it at this point.

    3. Re:Yes, network support. by jones_supa · · Score: 1

      A desktop which uses WebGL would be interesting.

    4. Re:Yes, network support. by maxwell+demon · · Score: 1

      Only if it is is a Windows browser running under Wine.

      --
      The Tao of math: The numbers you can count are not the real numbers.
  6. Beowulf by simonbp · · Score: 1

    Imagine a Beowulf cluster of these! It would be the slowest, worst cluster ever!

    1. Re:Beowulf by vux984 · · Score: 1

      came here to see this. thanks.

    2. Re:Beowulf by Anonymous Coward · · Score: 1

      Sounds like a Beowulf clusterfuck.

    3. Re:Beowulf by maxwell+demon · · Score: 1

      Actually I imagine you'd need to run your browser on a Beowulf cluster in order to get good performance of your VM.

      --
      The Tao of math: The numbers you can count are not the real numbers.
  7. Re:So...? by Horshu · · Score: 1

    For the runtime errors. The lovely, lovely runtime errors!

  8. Re:So...? by Sockatume · · Score: 4, Funny

    As a component of a Beowulf cluster, obviously.

    --
    No kidding!!! What do you say at this point?
  9. Yeah, but does it run... by sl4shd0rk · · Score: 3, Funny

    ..er, forget it.

    --
    Join the Slashcott! Feb 10 thru Feb 17!
  10. Even runs on iPhone 5s... by OlivierB · · Score: 3, 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

    --
    Artificial intelligence is no match for natural stupidity
    1. Re:Even runs on iPhone 5s... by WilyCoder · · Score: 2

      "my desktop dual core"

      isnt multiple cores irrelevant in the single threaded javascript environment?

    2. Re:Even runs on iPhone 5s... by OlivierB · · Score: 1

      You're right. The task manager was hovering around 100%, and but I forgot there was another chrome window running in the background

      --
      Artificial intelligence is no match for natural stupidity
    3. Re:Even runs on iPhone 5s... by bensyverson · · Score: 2

      With the introduction of Web Workers, JavaScript is no longer single threaded. It's pretty nice!

    4. Re:Even runs on iPhone 5s... by bensyverson · · 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 JavaScript, because as developers look to bridge the ARM/i386 and Mobile/Desktop worlds, web apps will look more and more attractive. This Linux emulator is a good proof of concept that you can basically do anything as a web app now. The floodgates are open.

    5. Re:Even runs on iPhone 5s... by Anonymous Coward · · 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.

    6. Re:Even runs on iPhone 5s... by Anonymous Coward · · Score: 1

      Careful, bullshit.
      geekbench3
      5s: ~1400 single core, ~2500 multi-core
      low-end 2011 mini (2415M): ~2300 single core, ~4600 multi-core
      It *is* pretty close to a 2009 17" MBP (== a Core2Duo T9550) or a 2007 mini...

    7. Re:Even runs on iPhone 5s... by bensyverson · · Score: 1

      Oh right, I forgot about XScale. Well in any case, it's an interesting move on Intel's part.

    8. Re:Even runs on iPhone 5s... by bensyverson · · Score: 1

      Oh, you're right—I had remembered the Geekbench 3 baseline (2500) as a 2011 Mac Mini multi-core, but the baseline is the single-core score.

      In any case, 2500 is very impressive for a phone. I did a lot of 3D rendering and video editing on that old 17" MacBook Pro, and this phone is just as fast.

    9. Re:Even runs on iPhone 5s... by vux984 · · Score: 2

      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

      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, or LG Nexus 5... sure I'll buy that too.

      Smartphones have the general performance of entry level PCs from 5+ years ago? Sounds plausible.

    10. Re:Even runs on iPhone 5s... by bensyverson · · Score: 1

      I was mistaken—I misremembered the baseline. The Geekbench 3 baseline is 2500 for the single core score of a 2011 Mac Mini.

      But my MacBook Pro 17 was a top of the line machine 4 years ago, not five. It's still pretty impressive that the 5s (and yes, top-end Android phones) can match it.

    11. Re:Even runs on iPhone 5s... by vux984 · · Score: 1

      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 is practically the same in terms of benchmark performance. And even Sandy Bridge isn't far behind. There hasn't been a big jump in performance since the Nehalem stuff in 2008. (Think I7 - 940)

      So with the desktop moving very slowly, and all the r&d everywhere, including intel, focused on power efficiency and mobile, its no surprise that smartphones are making a lot of progress relative to their larger cousins.

      But all that said I agree its still pretty impressive.

    12. Re:Even runs on iPhone 5s... by BZ · · Score: 2

      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.

    13. Re:Even runs on iPhone 5s... by bensyverson · · Score: 1

      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. That particular model averages about 2800, but there are scores in the 2500s, and there were lower end MBP 17s released that year.

      So yes, the new iPhone does match a 2009 MBP 17. In any case, we agree that this is a fast phone (not to discount the new Nexus or other top-of-the-line Androids, which as fast or faster).

      I think the thing with desktops / laptops is that we reached "way, way fast enough" a while back. The most processor-intensive thing most people will do is play 1080p content via YouTube or Netflix, which is a pretty low bar to clear. Couple that with declining computer sales at the same time as increasing smartphone sales, and it's definitely easy to see why the gap is narrowing. That's why I think it's inevitable that we'll get an ARM-based MacBook at some point.

    14. Re:Even runs on iPhone 5s... by vux984 · · Score: 1

      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 its probably true.

  11. Re:is javascript faster than java? by SJHillman · · Score: 2

    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.

  12. Re:is javascript faster than java? by elfprince13 · · Score: 4, Interesting

    JavaScript faster than Java? No. It's not. Not even close. Java has fantastic performance when used correctly. It just happens to be a common intro-course language, so lowest-common-denominator sorts of programmers write a lot of crap code with it. The HotSpot VM JIT is basically magic, and the garbage collection beats out everything else.

  13. Turtles all the way down by barlevg · · Score: 3, Insightful

    Can this Linux kernel run a Javascript VM? If so, can that VM run the Linux kernel? And if so, can that kernel run a Javascript VM? And if so...

    1. Re:Turtles all the way down by s-macke · · Score: 1

      In principle yes. But we have to cross compile the Javascript engine. And this is very difficult because the most important Javascript engines are very complicated to build and support only ARM and x86 CPUs.

    2. Re:Turtles all the way down by bensyverson · · Score: 1

      Not necessarily. Just start with an x86 emulator instead of an OpenRISC emulator.

      Really, with Emscripten you can do just about anything. There was a classic Mac emulator posted about a month ago.

    3. Re:Turtles all the way down by s-macke · · Score: 1

      I know. But to build an OpenRISC (1000-2000 lines for the core) emulation is much more easy than to build an x86 emulation (10000-20000 lines for the core). And I would not use the closed source emulator by Fabrice Bellard. Try this new emulator from: http://copy.sh/v24/ This seems to be a much better base for development.
      I have also made a list of online emulators currently available. https://github.com/s-macke/jor1k/wiki/Similar-emulators-written-in-Javascript
      Emscripten is boring. It uses no emulation. ;)

    4. Re:Turtles all the way down by bensyverson · · Score: 1

      Oh, I didn't realize you were the author of jor1k! It's amazing. Congratulations! I also didn't realize it was completely hand-written, rather than cross-compiled to asm.js. That is impressive.

      It definitely seems like you've gained a lot of speed by hand-coding the emulator. Have you seen jsbochs? I'd be curious to test it against the Virtual x86 you linked to.

    5. Re:Turtles all the way down by s-macke · · Score: 1

      Thank you very much. It was a year of constant effort to come so far. There is so much to say about the speed the emulator. The biggest issue is, that the rules are changing every few weeks when new browser version are released. Firefox 22 gave me 30 MIPS with the standard core. Firefox 23 reduced it to 10 MIPS for some reason. Instead the Chrome browser increased from 10 to 30 MIPS. It is crazy. The emulator runs at the edge of what is possible with current JIT compilers.
      The nice part is, that the asm.js part seems to run stable and fast. Yes, it is hand written. And I think it is faster than compiled code. The reason is in my opinion the goto handling of the emscripten compiler. Javascript doesn't have a goto command. On trick here is to use the switch/case statement to somehow reproduce a goto, which works, but slow.
      I have looked at all of the emulators I could find so far, also jsbochs. I think that if I would emulate Bochs inside my emulator it would also have a speed of 0.04 MIPS ;)
      There are so many small details which could reduce the speed - Flags, 64 Bit and so on. And just by recompiling you will not get that big speed improvement. OpenRISC is a nice architecture which is well suited for such an emulator.

  14. Re:So...? by Sloppy · · 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!

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  15. Any nerds left on /.? by Anonymous Coward · · 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.

    1. Re:Any nerds left on /.? by barlevg · · Score: 1

      The majority of SLASHDOTTERS and the majority of TROLLS are two different groups. js

    2. Re:Any nerds left on /.? by barlevg · · Score: 1

      It all depends on how you measure the "community." If you're talking about unique visitors to /., then I can pretty much guarantee that lurkers who never/rarely post are in the majority. Trolls, by their nature, tend to post more than other types of people on the interweb.

    3. Re:Any nerds left on /.? by Atzanteol · · Score: 1

      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'ing time*.

      For example:
      "What's the point of this? Why not spend more time getting chicks." (just mod it down - nobody cares that some luddite doesn't like new things)
      "Just use a Mac!" (as answer to every-single-ask slashdot no matter how off-topic).
      Many many more...

      Of course that would mean editors doing *work* so it's bound to fail...

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    4. Re:Any nerds left on /.? by Atzanteol · · Score: 1

      And now I un-did my moderations by posting non-AC. *sigh*

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
  16. Re:So...? by David_Hart · · Score: 5, Funny

    What does one use this for?

    The same thing we do every night, Pinky - try to take over the world!

  17. Re:is javascript faster than java? by Anonymous Coward · · 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.

  18. Re:is javascript faster than java? by goombah99 · · Score: 2

    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 commands. For example the lack of a class statement or a defined way to access a superclass is bewildering. It's even less complete that perl objects in many ways. Listing all the keys in a hash (associative array) gets conflated with all the other attributes of the hash, so there's weird kludges like "hasOwnProperty" that smack of being bandaid and afterthoughts. On the other hand it's got things like timed thread execution and some quite high level concept built in as primitives.

    What perplexes me the most is I haven't figured out how to debug it yet. I've been relying on a particular package called "processing.js" which has some very simple graphics. since processing.js acutally re-writes your javascript at run time, the messages in the browser console log are worthless. they don't even tell you the line number where the error occurs most of the time. The other debugging problem Ihave is that often the javascript one is writing only can work in the context of a web page (for example to play loaded sounds). so I don't see how one runs or debugs this outside of a browser. I don't get what the IDE's offer. I'm a noob so give me a clue not heckling please.

    Anyone have any advice on how to debug in java, especially when using processing.js.

    --
    Some drink at the fountain of knowledge. Others just gargle.
  19. First post! by Fwipp · · Score: 4, Interesting

    From my OpenRISC ORK Javascript Emulator Running With Network Support

    i.imgur.com/zJPsjCT.png

    1. Re:First post! by BaronAaron · · Score: 2

      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. ;-)

    2. Re:First post! by Fwipp · · Score: 1

      Yeah, I thought about that. I don't really care about my slashdot login. :)

    3. Re:First post! by s-macke · · Score: 1

      The websocket is not encrypted right now and sends ethernet frames back and forth. It is safe If you used https while logging in.Of course man in the middle attacks are more easy this way.

  20. Rich applications by DarkOx · · Score: 1

    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 :-)

    --
    Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
    1. Re:Rich applications by the_povinator · · Score: 1

      I wonder how long before someone claims it's faster than running Linux directly on hardware?

      --
      The .sig is dead, and I believe I had a hand in killing it.
    2. Re:Rich applications by ArsonSmith · · Score: 2

      I've found it to be faster than running Linux directly on hardware under certain circumstances.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
  21. Re:So...? by mlts · · 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.)

  22. Re:So...? by Anonymous Coward · · Score: 2, Informative

    All we need now is JS acceleration built in to cpus.

    Yo dawg, I heard you like VMs so..

  23. Re:is javascript faster than java? by Nerdfest · · Score: 2

    Someone here had a sig that was "Java is to Javascript as Car is to Carpet".

  24. Re:is javascript faster than java? by Immerman · · Score: 2

    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 substantially if you instead allocate a sufficiently large pool of objects and manage their usage yourself.

    Here's hoping someone can suggest a decent Java debugger - I abandoned it after a while in part because of the lack of something I would consider only slightly less vital than the compiler itself. Of course that would be of absolutely no use to somebody programming in the unrelated Javascript language.

    --
    --- Most topics have many sides worth arguing, allow me to take one opposite you.
  25. All joking aside... by tobiasly · · Score: 1

    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.

    1. Re:All joking aside... by Bill_the_Engineer · · Score: 1

      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.

      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.

      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.

      I don't understand how this is a less "hacky" solution, but it may work.

      --
      These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
    2. Re:All joking aside... by phoenix_rizzen · · Score: 1

      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".

    3. Re:All joking aside... by tobiasly · · Score: 1

      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 :)

    4. Re:All joking aside... by tobiasly · · Score: 1

      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.

    5. Re:All joking aside... by tobiasly · · Score: 1

      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.

  26. Re:is javascript faster than java? by erikkemperman · · Score: 3, 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.

    --
    Gosh, thanks. That must be why the other ships call me Meatfucker -- GCU Grey Area (Eccentric)
  27. Re:is javascript faster than java? by jones_supa · · Score: 3, Insightful

    javascript != java

    But you can still ask the question whether JavaScript is faster than Java.

  28. Re:is javascript faster than java? by SJHillman · · Score: 2

    You can ask a lot of questions, but that doesn't mean they're good questions.

  29. Re:is javascript faster than java? by GodWasAnAlien · · Score: 2

    > 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.

  30. Re:So...? by s-macke · · Score: 5, Interesting

    A year ago, when I started the project it was simply interest in learning Javascript. I was fascinated by the emulator from Fabrice Bellard http://www.bellard.org/jslinux/
    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
    And I have to admit that I did the wayland support last time only to get some news. :)

  31. Re:So...? by tech.kyle · · Score: 1

    For people who can't help but "rm -rf /"

    --
    If we colonize Mars, it won't be the World Wide Web anymore. UWW?
  32. Re:So...? by Will.Woodhull · · Score: 1

    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 you mix the colors together wrong and get something yuckie. She knows how to fix that, and if you come up with something really neat, she'll change the whole room to match your theme. Like what she did when Schroedinger did that sketch of a cat. Wow!

    --
    Will
  33. where do you not have ssh available? by Chirs · · Score: 1

    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.

    1. Re:where do you not have ssh available? by tobiasly · · Score: 1

      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.

  34. Re:is javascript faster than java? by viperidaenz · · Score: 1

    .... only if you live in a magical fairy land.

  35. Prelude to a new wave of drive by malware? by hAckz0r · · Score: 1

    Ok, supposing that instead of presenting a command line to the browser user the websocket/javascript instead installed a reverse command line back to the server, essentially giving a remote user access to the internal commands within the browser via the javascript kernel. All the remote user needs is a bug. plugin, or other feature that allows the browser to perform operations on the websurfer's host, like a fly-by install of malware or scraping the user environment of all information available. What prevents this scenario? How would the user even know other than the browser got reaaaalllly slooooowwwww.....

    1. Re:Prelude to a new wave of drive by malware? by Anonymous Coward · · Score: 1

      OK, suppose the attacker has login capabilities to the virtual Linux machine.

      Javascript normally only allows network connections to the same domain that the page is hosted on, and then only HTTP connections.

      There are no "internal commands" that an attacker get access to, just by running a virtual machine, other than the (already exposed) Javascript API, which comes with these limitations.

    2. Re:Prelude to a new wave of drive by malware? by hAckz0r · · Score: 1
      While I would agree with your statement about the constrained environment in general, there have been a lot of security flaws in javascript across all current day browsers.

      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=&sort=&as_lq=

      The above search at CERT.org has 814 hits for "javascript & exploit" alone.

      What more, the remote site would have access to your browser environment until you change to another HTML page, unless they first take advantage of little tricks to stay persistent. The longer they have to poke around your javascript environment the sooner they find the next big bug to hack into the system. All software has bugs, it just a matter of time to find one.

    3. Re:Prelude to a new wave of drive by malware? by s-macke · · Score: 1

      Wesockets do allow connections to any server. It's also working from this site: http://s-macke.github.com/jor1k/

    4. Re:Prelude to a new wave of drive by malware? by Anonymous Coward · · Score: 1

      My point was that there would be no advantage (from the attacker's perspective) of there being a virtual machine running Linux on the client. The attacker might as well serve the client with some (much simpler) javascript code targeting a specific exploit for the user's platform.

      I'm not sure what you mean by "poke around your javascript environment" to find the "next big bug". There are a limited number of Javascript environments (think: current web browsers and their popular versions), and when looking for a new bug to exploit the attacker has plenty of time at home to experiment before unleashing his/her newly built exploit code unto some helpless victim's unpatched browser.

      If the VM running Linux had some special privileges in the Javascript environment, then there would be a point in using this platform for exploits. But since it does not, the same goal can be achieved by much simpler means (even though I do not think it is easy to find new Javascript exploits).

  36. Re:So...? by Will.Woodhull · · Score: 2

    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.

    --
    Will
  37. Re:What Is The Fucking Point? by s-macke · · Score: 1

    The Linux Kernel was improved because of this emulator. Bugs in the OpenRISC part of the Linux Kernel were removed.

  38. Re:JVM by viperidaenz · · Score: 1

    Or you could just write a JVM in Javascript

  39. Re:LOL by rubycodez · · Score: 1

    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.

  40. Re:is javascript faster than java? by Mitchell314 · · Score: 1

    Or like similes to metaphors.

    --
    I read TFA and all I got was this lousy cookie
  41. Re:is javascript faster than java? by jones_supa · · Score: 1

    Very true. :D

  42. Re:So...? by Luyseyal · · Score: 1

    This is a cool project. Thank you for working on it.

    -l

    --
    Help cure AIDS, cancer, and more. Donate your unused computer time to worldcommunitygrid.org. Join Team Slashdot!
  43. Re:So...? by DocSavage64109 · · Score: 2

    I'm sure they'd be all over some guy because he managed to run a VM in a web browser.

  44. Re:is javascript faster than java? by narcc · · Score: 3, 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.

  45. Re:is javascript faster than java? by DdJ · · Score: 2

    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.)

  46. recylcing objects for speed and memory savings by goombah99 · · Score: 2

    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 overwriting it's attributes with new ones. But wait, to do that I had to instantiate the temporary hash { x:1, y:2, z:3} to transfer in those attributes. Which is memory allocation and object creation. It would in fact be simpler to write:

    var foo = { x:1, y:2, z:3};
    foo.prototype = oldObj.prototype;

    I would in fact think this latter way would be more efficient in both speed and memory. So How do I save anything by recylcing?

    is there a better way to recycle? what am I missing

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:recylcing objects for speed and memory savings by narcc · · Score: 1

      Try again. You'll get there.

    2. Re:recylcing objects for speed and memory savings by goombah99 · · Score: 1

      *clue needed

      --
      Some drink at the fountain of knowledge. Others just gargle.
    3. Re:recylcing objects for speed and memory savings by narcc · · Score: 1

      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.

  47. Re:So...? by dreamchaser · · Score: 1

    It runs. It's not fast, no, but it runs fast enough to actually play around with.

  48. DUPE? by Freshly+Exhumed · · Score: 1
    --
    I deny that I have not avoided attaining the opposite of that which I do not want.
  49. Re:is javascript faster than java? by gl4ss · · Score: 2

    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 a cheat though, with the same technique(and simpler) you could launch nuclear missiles from javascript in browser. sure it would depend on a gateway to actually launch them....

    --
    world was created 5 seconds before this post as it is.
  50. Re:JVM by bensyverson · · Score: 1
  51. Re:is javascript faster than java? by Darinbob · · Score: 1

    We are talking about a browser running on Linux running on a browser that's running on Linux...

  52. Re:So...? by Anonymous Coward · · 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."

  53. need help with WINE by locopuyo · · Score: 2

    I am having trouble setting up WINE with this. Can someone help me setup WINE so I can play Crisis on my Nexus?

    1. Re:need help with WINE by s-macke · · Score: 1

      Sorry, it is not a X86 Emulation. And Graphic Card support (3D) is still missing. You can however install Qemu, Dosbox or Bochs in the emulator and try to run Crisis. Might be, that you get some memory problems. :)

    2. Re:need help with WINE by bensyverson · · Score: 1

      It's possible to compile bochs to Javascript using Emscripten, so it's only a matter of time. If you do get Crisis running, let us know what kind of framerate you're getting. :)

  54. Re:is javascript faster than java? by narcc · · Score: 1

    java can run in parallel and is superior in just about every way

    Wow, no. JS is pretty obviously the more sophisticated language.

  55. Re:Because Javascript sucks by s-macke · · Score: 1

    Yes, Javascript sucks. But which language runs on all devices?. Do you think if this would be programmed in Perl someone would notice it? One click and you have a Linux system in front of you. But I hope as well that we can get rid of Javascript someday.

  56. Re:So...? by K.+S.+Kyosuke · · Score: 1

    Got a new customer? Just open another tab!

    Based on your description, I believe that I've already seen prior art in restaurants.

    --
    Ezekiel 23:20
  57. Re:So...? by TangoMargarine · · Score: 1

    I'm not sure where this analogy is going...

    --
    Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
  58. Re:LOL by s-macke · · Score: 1

    I don't know what you mean by real OS. But if you mean Windows. Windows 95-Windows2000 should be possible to emulate. The newer Windwows version might work as well in future. It depends on the amount of memory the web browsers provides you and of the bandwidth of your network connection. Download 500MB before you see the Desktop? But you can't put them online as this will violate copyright law.

  59. Re:So...? by Atzanteol · · Score: 1

    +1 - very cool project.

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  60. Re:is javascript faster than java? by Atzanteol · · Score: 1

    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

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  61. Re:is javascript faster than java? by Atzanteol · · Score: 1

    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.

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  62. Re:So...? by nemesisrocks · · Score: 2

    What does one use this for?

    To get chicks?

    Unlikely -- doesn't work in Internet Explorer.

  63. Re:LOL by warmflatsprite · · Score: 1

    Be advised that this isn't a port of the kernel to JavaScript. The JS in that page is emulating a computer which executes a kernel built against the or1k architecture (as opposed to x86, or any of the arm variants).

  64. No joy here by jago25_98 · · Score: 1

    Stuck at "Loading kernel and hard drive image" for me under windows, online an offline, Chrome and IE.
    I must be cursed.

    1. Re:No joy here by s-macke · · Score: 1

      Dependent on your connection you must be very patient. It has to load around 10MB from the web server. The emulator works in Firefox, Chrome and IE. Maybe you have more luck with this link: http://s-macke.github.io/jor1k/

  65. Re:So...? by Tetetrasaurus · · Score: 1

    Well, if you pile enough VMs on top of each other, eventually you could have some confidence you won't get rooted too many levels deep when downloading off the internets.

  66. Re:is javascript faster than java? by s-macke · · Score: 1

    I have in my wiki a site describing the speed problems and how I solved them. https://github.com/s-macke/jor1k/wiki/Technical-details
    I am not doing any memory allocation during the emulation.Everything is done at the beginning.
    Debugging is a real issue. I used mainly console.log. But Firefox and Chome provide some debugging features.

  67. Re:is javascript faster than java? by JamieIanMacgregor · · Score: 1

    That's a good point... how many levels deep can you run this?

  68. OS Prototyping engine by Tekoneiric · · Score: 1

    I think a setup like this would be good to develop a OS prototyping engine. Instead of working low to high level like most operating systems you could work at all levels to perfect the upper level look & feel and adjust the lower level to correct for problems affecting higher level & security. Sort of like what going from type writers to word processors did for writing.

    --
    *It's not what you can do for the Dark Side but what the Dark Side can do for you!*
  69. Re:So...? by IwantToKeepAnon · · Score: 1

    What does one use this for?

    Self-achievement? Learning? To get chicks?

    Silk road?

    --
    "Happy families are all alike; every unhappy family is unhappy in its own way." -- Anna Karenina by Leo Tolstoy
  70. ob by Hognoxious · · Score: 1

    However until now none of them had network support, so they weren't too terribly useful.

    And with it they cure cancer, solve world hunger and make perfect soufflé?

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  71. Re:F*ck it by maxwell+demon · · Score: 1

    But where do I get TurboCOBOL for Firefox?

    --
    The Tao of math: The numbers you can count are not the real numbers.
  72. Re:is javascript faster than java? by Immerman · · Score: 1

    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 building upon.

    --
    --- Most topics have many sides worth arguing, allow me to take one opposite you.
  73. Re:is javascript faster than java? by Atzanteol · · Score: 1

    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.

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  74. Re:is javascript faster than java? by Immerman · · Score: 1

    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). If I know I'm going to be operating in "batches" where I will allocate lots of objects before finally deallocating them all at once (not uncommon in games and other iterative/simulation/rendering environments) then I can do one better and completely eliminate all the overhead associated with deallocation, and instead just start reusing the array as if it were fresh after each conceptual "mass deallocation".

    Either way I've managed to eliminate not just the overhead directly associated with millions of allocations and deallocations per frame, but also completely eliminate the additional work required behind the scenes to defragment memory. And as a bonus I've kept my messy, memory-abusive allocations completely isolated from the general-purpose memory manager, helping to reduce the amount of fragmentation that gets introduced elsewhere, boosting performance even further.

    --
    --- Most topics have many sides worth arguing, allow me to take one opposite you.