Javascript PC emulator runs Linux
Fabrice Bellard, creator of the multiple architecture emulator QEMU and FFmpeg, amongst other open source projects, has unleashed his Javascript powered PC emulator. In its current state, it boots a stripped down, text mode Linux implementation and runs within a modern browser. Interesting curio or a potentially useful tool?
To say it's written in Javascript, an interpreted language that is usually used for client-side scripting on web pages, the emulator runs remarkably quickly. It boots to a command prompt in about a minute on this machine (Sempron 3000, FF 4.1). [Update: Considerably faster than that on my CoreDuo] By the way, the emulator requires a modern browser such as Firefox 4 or Chrome in order to operate.
Things are still at the proof of concept stage but there is already enough to play around with. Sitting on a command line prompt, the first thing I tried was typing ls. Doing this revealed the presence of a single file, a C source code file called hello.c. Attempting to compile with GCC wont work because GCC isn't installed. Examining the content of the file got the the bottom of things:
~ # cat hello.c
/* This C source can be compiled with:
tcc -o hello hello.c
*/
#include <tcclib.h>
int main(int argc, char **argv)
{
printf("Hello World\n");
return 0;
}
~ #
That the system includes the Tiny C Compiler (not to be confused with Small-C) makes sense as that is another project that was started by Bellard. You can get an idea of what other utilities are supported by the system by typing
ls /bin
So, what could this thing actually be used for, I hear you ask? As it stands, not all that much. For one thing, networking is not yet emulated. To perform any type of file transfer between the host and guest environments, one has to use the system cut and paste buffer and a virtual /dev/clipboard device. Other than that, there's no way to get data into or out of the system. This could be a point in the system's favor because, as it really is running locally, rather than on a server, it's fairly good in privacy terms. You can wipe the entire system by simply hitting refresh.
It could perhaps be used to provide some sort of training environment to teach people how to use the Linux command line. As it stands, the system could be used to compile simple snippets of C code if you were to find yourself stuck on a machine without a compiler installed.
[Update: Seems that a pal of mine, Chris Williams, is using it to demo his hobbyist microkernel project Diosix]
The implementation of a complete machine emulator is not the type of task that Javascript was created for. If you really needed a Linux command line that can be accessed without installing anything to the host machine, you'd be better off either SSHing into a remote box or running a virtual machine locally. If it must be browser based, a Java based PC emulator would be quite slow but it would still run faster than one written in Javascript. The JPC website even hosts some example Linux demos that you can try out, but of course, they require that you have Java installed.
Bellard's Javascript PC Emulator is an intriguing feat of programming, but it's likely that it wont see much practical use. It's still cool though.
The Javascript PC Emulator website.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- New Products
- Using Salt Stack and Vagrant for Drupal Development
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Tech Tip: Really Simple HTTP Server with Python
- Kernel Problem
1 hour 11 min ago - BASH script to log IPs on public web server
5 hours 38 min ago - DynDNS
9 hours 13 min ago - Reply to comment | Linux Journal
9 hours 46 min ago - All the articles you talked
12 hours 9 min ago - All the articles you talked
12 hours 13 min ago - All the articles you talked
12 hours 14 min ago - myip
16 hours 39 min ago - Keeping track of IP address
18 hours 30 min ago - Roll your own dynamic dns
23 hours 43 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
I ran rm -rf * LOLOLOLOLOLLL
I ran rm -rf *
LOLOLOLOLOLLL
This is so cool! OK everyone
This is so cool!
OK everyone put your heads together and ponder what other interesting uses this can have.
Absolutely! I have no idea
Absolutely! I have no idea what this could be used for, but it is simply cool. Any of you old enough to remember people asking similar questions about Linux itself?
Wow, it's great, Someday I
Wow, it's great, Someday I wanna make that kind of system : )
Does not require FF 4, unless
Does not require FF 4, unless you are referring to a specific function, seems to run fine on FF 3.6.17 (claims to take 34s to boot).
this is... art.
this is... art.
Missed the point entirely
No GCC? Are you serious? This is a demo of Bellard's programming prowess plus the power of JavaScript. Maybe one day, Linux will just be a bootloader for JavaScript.
Nothing wrong with it not
Nothing wrong with it not having GCC. In fact, it would probably be inappropriate on such a resource constrained environment.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.