The Glade 4.0

"Turn the lights down, the party just got wilder."
It is currently Sun Nov 24, 2024 3:29 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Linux in JavaScript
PostPosted: Fri May 20, 2011 9:38 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Quote:
We often use emulators like Qemu, Virtualbox, VMWare to virtualize another Operating systems on a different platform.

Qemu is popular and open source emulator that lets you virtualize nearly any OS on any other OS. Qemu has now been ported to a new platform: Browsers. Most modern browsers like Chrome 11 and Firefox 4 can run this javascript based Emulator making it possible to run an actual Linux in your browser.

Since javascript is slower than native code, one would expect slower boot times for the Linux, but it boots amazingly fast. With a very minimal download and couple of seconds, your browser window boots into an actual Linux based on commandline. Ofcourse CLI-only makes the OS snappy for executing all your shell commands.

If you aren’t excited so far, read this again: “A PC emulator written in javascript, and running solely in browser“.

This PC emulator is written entirely in Javascript. The emulated hardware is:

a 32 bit x86 compatible CPU
a 8259 Programmble Interrupt Controller
a 8254 Programmble Interrupt Timer
a 16450 UART.
The code is written in pure Javascript using Typed Arrays which are available in recent browsers. It was tested with Firefox 4 and Google Chrome 11 on Linux, Window and Mac. It doesn’t work with Opera.

CPU Emulation

The code is inspired from my x86 dynamic translator present in QEMU, but there are important differences because here it is an interpreter. The exact restrictions of the emulated CPU are:

No FPU/MMX/SSE
No segment limit and right checks when accessing memory (Linux does not rely on them for memory protection, so it is not an issue. The x86 emulator of QEMU has the same restriction).
No CS/DS/ES/SS segment overrides. FS/GS overrides are implemented because they are needed for Thread Local Storage in Linux.
A few seldom used instructions are missing (BCD operations, BOUND, …).
No single-stepping
No real mode
No 16 bit protected mode (although most 16 bit instructions are present because they are needed to run 32 bit programs).
Most of these restrictions are easy to remove.

Linux distro & kernel

It runs 2.6.20 Linux kernel with configuration available here.

The disk image is just a ram disk image loaded at boot time. It contains a filesystem generated with Buildroot containing BusyBox. I added my toy C compiler TinyCC and my unfinished but usable emacs clone QEmacs.

Javascript Performance

PC emulator is about 2 times slower using V8 than Jaeger Monkey on 32bit desktops.

I still have to try this on mobile browsers, let me know if that works for you.


http://bellard.org/jslinux/

So cool. I'm going to play around with this.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 20, 2011 11:14 am 
Offline
Lean, Mean, Googling Machine
User avatar

Joined: Thu Sep 03, 2009 9:35 am
Posts: 2903
Location: Maze of twisty little passages, all alike
Haha. This is technically impressive, but seriously WTF.

_________________
Sail forth! steer for the deep waters only!
Reckless, O soul, exploring, I with thee, and thou with me;
For we are bound where mariner has not yet dared to go,
And we will risk the ship, ourselves and all.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 20, 2011 9:22 pm 
Offline
pbp Hack
User avatar

Joined: Wed Sep 02, 2009 8:45 pm
Posts: 7585
Why? Because you can is not a valid answer.

_________________
I prefer to think of them as "Fighting evil in another dimension"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 20, 2011 11:09 pm 
Offline

Joined: Wed Sep 02, 2009 10:49 pm
Posts: 3455
Location: St. Louis, MO
History would tend to disagree with you.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Sat May 21, 2011 2:58 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Sat May 21, 2011 3:47 am 
Offline
User avatar

Joined: Sun Sep 20, 2009 5:31 pm
Posts: 1532
Lex Luthor wrote:
Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.


that's what putty is for

_________________
Ron Paul 2012


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Sat May 21, 2011 11:36 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Nevandal wrote:
Lex Luthor wrote:
Rorinthas wrote:
Why? Because you can is not a valid answer.


Well for one it could be a good way to give a class an introduction on Linux without installing anything on their computers.


that's what putty is for


Don't you have to download it? And that's not an OS... everything about your post is wrong.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 21, 2011 2:59 pm 
Offline
User avatar

Joined: Sun Sep 20, 2009 5:31 pm
Posts: 1532
I suddenly feel like I'm on an episode of The Big Bang Theory.

Yes, you have to download PuTTY. It's an SSH client.

In my *nix introduction class we used PuTTY to SSH into the Linux server. The class was called "Introduction to *nix" It worked well for this purpose.

Facts:
1. You also have to download Linux in Javascript in order to use it
2. It's not an OS either.
3. everything about your face is wrong.

_________________
Ron Paul 2012


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Sun May 22, 2011 1:00 pm 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Nevandal wrote:
Facts:
1. You also have to download Linux in Javascript in order to use it
2. It's not an OS either.
3. everything about your face is wrong.


1. No you don't, it runs in your browser. If by "download" you mean download the HTML and script files that your browser automatically handles, then you by the same meaning you have to "download" my post to read it. It's a trivial operation.
2. It's an emulated OS.
3. With PuTTY, the students don't get root privileges.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 145 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group