back to article Linux kernel runs inside web browser

An independent programmer has used JavaScript to build a PC emulator capable of running Linux inside a web browser. French hacker Fabrice Bellard says his JavaScript PC Emulator can run the 2.6.20 Linux kernel inside Mozilla's Firefox 4 and Google's Chrome 11, two browsers designed to significantly advance JavaScript speeds. " …

COMMENTS

This topic is closed for new posts.

Page:

  1. AdamWill

    Practical uses

    "Bellard believes his emulator could be used for client-side cryptographic processing. Or – if you're looking for a more serious pursuit – he also points out it could eventually let you play old DOS games."

    A wag on another comment thread pointed out that if only someone could get Apache to run on it, you could have penguins all the way down...

  2. Pawel 1
    Go

    Is it just me...

    or do you also think that there would be a lot of people interested in this and thinking of Chrome OS?

    1. Anonymous Coward
      Anonymous Coward

      Oooh....

      I wonder if you could get Google to implode in a puff of logic?

      Google: You can't run anything on Chrome OS, it's all in the browser

      Man: But this Javascript emulator allows you to run a fully featured PC in the browser, so you can install run anything you want natively

      Google: Gahhh?!?

    2. Ammaross Danan
      Coat

      Chrome

      Nah, Chrome's already covered: Native Code plugin FTW!

      (yes, sarcasm)

  3. Eddy Ito
    Happy

    The real question

    Will it run Emacs... on the iPhone? Muwahahahahahahaha!!!

    No, really?

    1. David Hicks
      Linux

      LOL

      Apparently not so much yet, the iPhone browser won't run it, instead the emulator puts up a "Browser not supported" message.

      I got it running in Firefox on my N900 though :)

      1. Robert Heffernan
        Linux

        LOLOL

        And I had it running in Firefox on my Galaxy S!

      2. bazza Silver badge
        Pint

        @David Hicks, absurdity

        OK so it doesn't work on an iSomething yet. But how long before we see Steve Jobs start trashing Javascript?

        The language is only going to get faster on Androids, Blackberries, etc. and as it does so the opportunities for things like this to become more serious and more capable will only increase.

        Now it would be an absurd way to run whatever software you like on a phone. You'd need a pretty good network connection for storage (I'm presuming that Javascript can't store data locally on an iPhone). The battery consumption is going to be terrible in comparison to running an equivalent native application. But with such restrictive practises eminating from His Jobness it is quite possible that absurdity will not be such a high barrier afterall.

        1. ThomH

          @bazza

          Apple shipped a major speed boost to the Javascript engine in Mobile Safari in iOS 4.3, though they got slammed — rightly or wrongly — for not applying it to the entire OS. It's not just "going to get faster on Androids, Blackberries, etc", it is getting faster on Androids, Blackberries, iPhones, etc.

          The iPhone supports the latest HTML 5 database stuff, for local persistent store, as does Android. Blackberry doesn't.

          Even since the App Store launched and Apple stopped saying "HTML + Javascript is the API", they've failed to become more restrictive. Every added restriction on one side, such as the 70:30 rule for subscription content, is balanced by one eased on the other, such as the removal of the C/C++/Objective-C/Javascript rule for apps which allows people to use Adobes development tools if they wish.

          To my knowledge, Jobs has spoken out publicly only against Flash. The arguments he made that it offers a very poor user experience on mobile have been backed up by every objective review I've seen of the Android client. I doubt I'm alone in having decided never to download the thing onto my Android phone. His conclusions — to ban Flash from his platform — betray his control tendencies but the initial observations were valid.

          So, in response to your post: (i) Apple have been improving their Javascript implementation; (ii) Apple do support local storage for Javascript applications; (iii) Apple's maniacal level of control over the iPhone platform has remained more or less constant rather than being some sort of ever-growing all encroaching beast; and (iv) Jobs has publicly trashed technologies only when they deserve to be trashed (his actions following the trashing being the objectionable bit, not the trashing itself).

          History has also shown Apple to be a beneficial contributor to the web ecosystem, being the driving force behind the vast majority of WebKit development (it was forked from KHTML when that project was four years old, which was nine years ago) and the originator of the canvas element and 2d/3d CSS transforms amongst others. As far as I can think, they've done nothing at any time to hurt the development and propagation web standards.

          I'd therefore suggest that Javascript will remain just as viable on iPhones as everywhere else in the world, give or take that Apple's Javascript implementation tends to lag Google's in speed increases.

        2. Mike Moyle

          @ bazza Re: "iP*d storage

          "You'd need a pretty good network connection for storage (I'm presuming that Javascript can't store data locally on an iPhone)."

          I wonder if it would work with one of the battery-powered Seagate drives for iP*d that the Reg reported on on Monday... http://www.reghardware.com/2011/05/16/seagate_goflex_satellite/

        3. M Gale
          Badgers

          Choc Chip or Ginger Nut?

          "(I'm presuming that Javascript can't store data locally on an iPhone)"

          Giganto-cookies? Base64 encoding?

          Oh yes I'm that perverse.

          1. rciafardone
            Go

            Perverse... or evil

            <Insert evil laughter here>

    2. The Fuzzy Wotnot
      Happy

      No no no!

      Will it allow me to run the game Syndicate in a browser!

    3. copsewood
      Linux

      don't know about emacs

      That would be cool, but I've tried it and it runs vi just fine. I've also got the thing to compile a C program (tcc command) and to execute an ash shell script. It doesn't have any networking or ability to upload/download any files - so it's a closed world inside the emulation currently.

  4. Mike VandeVelde
    Pint

    for he's a jolly good fellow!

    cheers! :-)

  5. Anonymous Coward
    Thumb Up

    Anyone for Digger?! :D

    'nuff said!

  6. ratfox
    Coat

    Can you run Wine on it?

    I'll get my coat

    1. MinionZero
      Happy

      How about running a VM on it!

      @"Can you run Wine on it?"

      If we run a VM on it, we can install any OS on it we like! :)

      So for example, how about ...

      Browser -> JavaScript -> Linux kernel -> VM -> WindowsXP -> Amiga Emulator -> ZX81 Emulator! :)

      With a VM, the possibilities are endless :)

      1. Anonymous Coward
        Happy

        Yo dawg

        I heard you like teh internets so we put a browser in a VM in your browser so you can browse while you browse

  7. Martin Budden Silver badge
    WTF?

    Mr

    I know he explains why he did this, but... WHY???

    1. Ken Hagan Gold badge
      Boffin

      Re: WHY???

      To gain Respect from the sort of person who doesn't need to ask why.

      Curiously enough, although both Javascript and the Linux kernel are the work of Satan, getting the latter to run inside the former is somehow ... angelic.

      1. rciafardone
        Flame

        Abomination i say to thee!

        Emulation must be only of a OS into a onother OS, not a OS inside a "machine" with a script language running on a browser!!! it is madness!!! MADNESS!

        Fire because you must all burn at the stake...

    2. The Fuzzy Wotnot
      Happy

      Simply because!

      I take landscape and abstract photos purely for my own amusement, I share them on a website but I mainly take them to exercise the other half of my brain. I don't expect anyone to like them, I'm not really that bothered what people think of them.

      Sometimes it's fun to do something for no other purpose that your own enjoyment. It's not a crime to be completely unproductive sometimes, it's very good for the soul and helps keep the old noggin on balance.

      I work with two or three people who spend their entire lives worrying about work, their house and their financial portfolio and nothing else. They get so stressed about the smallest things upsetting any of these three subjects. Seems like the quickest way to the graveyard to me, but there you go.

      It'd be a boring world if we all liked the same thing I suppose.

    3. A J Stiles
      Coat

      Why?

      For approximately the same reason why people climb mountains, swim large bodies of water, walk trails of several hundred kilometres or visit unexplored or inaccessible places.

      Mine's the one with the Lofty Wiseman baccy tin survival kit in the pocket and the compass on the zip puller .....

  8. Robert E A Harvey
    Headmaster

    Turing

    Didn't St Alan prove that any programmable could be made to emulate any other?

    (could != should)

  9. Naich
    Thumb Up

    Useful

    It's got emacs, vi and a compiler. This could actually be useful. It's a shame there is no permanent storage or working network stack.

    Also, you can get a cheap thrill by "rm -rf /"ing and watching the poor thing eat itself.

    1. Anonymous Coward
      Coffee/keyboard

      title

      "Also, you can get a cheap thrill by "rm -rf /"ing and watching the poor thing eat itself."

      Excellent!

    2. captain veg Silver badge

      shame there is no permanent storage

      Don't understand.

      You aren't one of those strange people that turns their computer off, are you?

      -A.

  10. Anonymous Coward
    Pint

    "I did it just for fun"

    Someone buy that man a beer! Anything, just to get him out of the house...

  11. jake Silver badge

    Why? The mind boggles ...

    You have an OS that runs a modern browser that runs a glorified scripting language ... and then you re-implement that OS on top of that scripting language?

    Yeah, I grok that the browser & scripting language run on other OSes ... but somehow this seems to me to be a bit of "look at MEEEEEEE!" techie masturbation, with no actual useful RealWorld[tm] use.

    I could be wrong. It's been known to happen.

    1. Sam Liddicott

      He didn't do it for you

      He didn't write it for you, and surely your inability to find a RealWorld[tm] use is a problem with your own RealWorld[tm] or your own imagination.

      The author said he wrote it for fun. I find that to be a good enough RealWorld[tm] application - for the one having the fun, that is.

      I had fun with it too.

    2. John Wilson
      Linux

      "Why did you climb the mountain?" "Because it was there"

      Not everything is done because it is useful. Somethings are done just because someone looked and said "I wonder...", others are done because someone was bored, some because it looked interesting.

      Someone got a Linux emulator running in JavaScript. If you can't just look at that and say "wow, that's freaking COOL", and find that to be enough, you're kind of missing the point.

    3. Anonymous Coward
      Anonymous Coward

      'a bit of "look at MEEEEEEE!"'

      would you say that it's similar in that way to endless posts bragging about horse ranches, wineries, yachts, Cadillacs and Rolls Royce cars, implausible numbers of degrees, SAIL, Berkeley/Stanford (whichever it was, probably both), Slackware, ..?

      FB's list of achievements is real and seems to suggest that attention-seeking is not his goal.

      "to each his own", I suppose..

      1. dssf

        I wish IBM would hire talent like him and resurrect Lotus SmartSuite

        and bring it up to date instead of that current offering that IBM is pushing.

        It's very impressive that he did this just for fun. It's amazing what determined developers can do when they want. Too bad big companies don't always think about the user this way.

      2. jake Silver badge

        @AC 11:45 (and a few point to ponder for the rest of youse ...)

        Not bragging. Illustrating, to make a point.

        Please note that I stated quite plainly that I do not own Cadillacs, nor Rolls Royces. Please read for comprehension.

        FB's name is attached to his useless (although amusing) hack. It's a good hack, I'll go there ... along the lines of SCO's UNIX port to the 8088. But unlike the original SCO[1], FB seems to be calling attention to himself; showboating, if you will.

        Me? Not so much. I'm not exactly putting my name out there, now am I?

        This hack is *roughly* equivalent to writing an 8088 emulator in Qbasic, and then running MSDOS 3.0 on it under MSDOS 5.0 on a 386sx16 ... Looking at it that way, it's kinda pointless, no? FB could do a lot more good working on video & wireless drivers instead ...

        Looking forward to many more "thumbs down" :-)

        [1] If you don't know what I mean by "SCO Xenix", kindly don't bother replying. Ta.

        1. sabroni Silver badge
          Unhappy

          no idea what you mean by "SCO Xenix"

          but I'm confused by your definition of hack. Writing a processor emulator isn't a hack. Making an existing piece of software do something it wasn't designed to is a hack. Javascript is a language and this guy has written an emulator in it. He hasn't hacked anything, he's created a pretty cool piece of code.

          This isn't roughly equivalent to doing anything in Qbasic. Javascript is everywhere these days, on devices of all sizes from many manufacturers, running server side and client side. So this actually enables 486 emulation just about anywhere.

          You consider this work to be kinda pointless? He did it for fun. If you don't think having fun can be a valid reason for doing something then your life must be a bundle of laughs......

          1. jake Silver badge

            @sabroni

            "I'm confused by your definition of hack."

            http://www.catb.org/jargon/html/H/hacker.html

            "This isn't roughly equivalent to doing anything in Qbasic."

            Basic was the javascipt of the late '70s, 80s & early '90s.

            "So this actually enables 486 emulation just about anywhere."

            I had VM hardware machines "just about anywhere" on bare hardware a couple decades ago, WITHOUT the need of an additional OS, browser, scripting language, and hardware emulator to run the OS and software.

            "Fun" is a matter of perspective. KISS is an engineering principle I adhere to ...

            1. sabroni Silver badge

              @jake 19:10

              >http://www.catb.org/jargon/html/H/hacker.html<

              yeah, that's one definition, a brief scout round the interwebs reveals quite a few others, but I take you point.

              "Basic was the javascipt of the late '70s, 80s & early '90s"

              Well, sort of, but javascript implementations are all based on w3c script standards. QBasic wouldn't run on a commodore pet, a spectrum or an atari st. Whereas Javascript is genuinely able to run on devices from mobile handsets to web servers. So I disagree here, basic is too fragmented and non-standard to claim it's the same as contemporary javascript.

              "I had VM hardware machines "just about anywhere" on bare hardware a couple decades ago, WITHOUT the need of an additional OS, browser, scripting language, and hardware emulator to run the OS and software"

              These days most pcs have an os, browser and scripting language. So running this would be much less effort than setting up the bare hardware and virtual machines you mention. So maybe keeping it simple from a client perspective is also valuable?

    4. GatesFanbois
      Thumb Up

      title

      Yo Dawg we heard you like OSs so we put an OS in your browser on your os so you can use the OS in your browser while its running on your OS

    5. ChrisC Silver badge

      Why?

      "... and then you re-implement that OS on top of that scripting language?"

      No, then you implement some virtual hardware capable of running the original implementation of that OS. The end result may currently appear the same - OS running within a browser, woo - but whereas re-implementing the OS would have only ever given us the ability to run that OS within the browser, implementing a virtual PC instead gives us the potential (within the restrictions of the virtual hardware) to do other stuff too.

      1. Zippy the Pinhead

        @ ChrisC

        So if you virtually turned off the wrong PC within your VM would that cause a blackhole that sucked in the entire planet? lol

    6. juice

      There's lots of uses for a JavaScript x86 emulator

      It's worth noting that the emulator isn't emulating the OS; it's emulating the hardware which the OS runs on. Which makes it a lot more useful.

      I've no doubt that this was at least partially done just because it could be done, and the limitations of JavaScript mean it's severely hampered in some respects (file access, network access, etc). Then too, it probably needs a few optimisation passes - 486-level performance isn't particularly useful these days. But the point still remains: with JavaScript interpreters being so widely available, this provides a sandboxed way of running x86 code on virtually any piece of modern hardware in the world, whether it's a phone, tablet, laptop, settop box or something else altogether...

      It's also worth noting that while it's probably the most ambitious JS-emulator to date, this is far from the first - there was a ZX Spectrum emulator released back in 2008...

      http://matt.west.co.tt/spectrum/jsspeccy/

    7. rciafardone
      Boffin

      it has a lot of Potential aplications.

      With it you could theoretically test any program for one OS AND architecture on top of another.

      Heck you could automatize testing by running a program with deferent virtual peripherals.

      Imagine if a game companies could taste their games on any imaginable hardware configuration without having to actually buy and set the irons.

      A small farm of computers could easily reproduce the performance of a high end machine.

      1. jake Silver badge

        @rciafardone

        "With it you could theoretically test any program for one OS AND architecture on top of another."

        I've been doing this with VMs on raw hardware for a couple decades ... without an additional browser & scripting language and hardware emulation & OS & program getting in the way.

        Sometime KISS just makes sense ...

  12. Adze

    LOLOLOL

    ...and now HTC Desire running Fennec (but with no soft keyb was a little redundant. Trackball button funtions as return key so definitely running and not hanging)

    1. Paul 129
      Heart

      NO FAIR

      I had to lookup fennec! There sooo cute!!!! I want one

  13. Avalanche
    Go

    Woohoo infinite recursion!

    Just load Linux, start Firefox, load Linux-in-browser, start Firefox etc etc.

    BTW: "the man [..] now servers as senior JavaScript architect", seriously? Servers?

    1. Anonymous Coward
      Boffin

      title

      "BTW: "the man [..] now servers as senior JavaScript architect", seriously? Servers?"

      I thought all nerds did that? I certainly do.

    2. Mike Flugennock
      Coffee/keyboard

      re: Woohoo!

      "Just load Linux, start Firefox, load Linux-in-browser, start Firefox etc etc..."

      Ouch. My head just exploded.

    3. dssf

      And, run VirtualBox in that infinite recursion

      And add enhanced, faster networking than the UART...

      Add RAM, strong graphics, super CPU... this might make for one hell of a honey net add-on... Imagine setting up and tearing down virtual nets in a honeynet that -- if desired -- traverses the Net to other honey nets.

Page:

This topic is closed for new posts.

Other stories you might like