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.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
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
| 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 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Home, My Backup Data Center
- A Topic for Discussion - Open Source Feature-Richness?
- What's the tweeting protocol?
- Dart: a New Web Programming Experience
- Developer Poll
- Trying to Tame the Tablet
- Reply to comment | Linux Journal
2 hours 25 min ago - Reply to comment | Linux Journal
4 hours 58 min ago - Reply to comment | Linux Journal
6 hours 15 min ago - great post
6 hours 50 min ago - Google Docs
7 hours 12 min ago - Reply to comment | Linux Journal
12 hours 1 min ago - Reply to comment | Linux Journal
12 hours 47 min ago - Web Hosting IQ
14 hours 21 min ago - Thanks for taking the time to
15 hours 58 min ago - Linux is good
17 hours 56 min ago
Enter to Win an Adafruit Prototyping Pi Plate 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 Prototyping Pi Plate 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
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



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.