The name Fabrice Bellard may not be recognizable to a lot of people, but the work he carries out as a programmer and computer scientist is. . . . He is a very talented programmer, and his latest project demonstrates once again just how talented he is. Using the super-fast JavaScript engines that now come as standard in popular web browsers, he has managed to create a PC emulator that runs in a browser. As a demonstration he has posted a link to a version of the Linux kernel running in such a scenario.
If you follow the links you can try it out…
I messed around for a little while, he’s got an image with a hello world file you can compile and run yourself from in the browsers window.
The possibilities of running a full-blown emulator in th e browser are potentially stunning
Maybe a little scary.
.. and it’s very fast. The small Linux environmant booted much faster than my regular Linux installations. I also compiled the very small hello.c program, and I could not notice any load on my CPU.
The possibilities are interesting. Not only running old DOS games, but running all kind of virtual machines inside a browser.
Funny, though, first all the effort being done to develop a high-level language like javascript to avoid programming in assembly or C, and then using javascript to get back to C…
I think there’s a quote out there somewhere that everything that could be made in JavaScript will be made in JavaScript, and anything that can’t be made in JavaScript will be emulated in JavaScript
While you are on the subject of quotes, I noticed someone mentioned on Reddit: “Don’t act surprised when you see Windows 95 booting up in chrome or firefox in the near future.”
Prior to that event, you can try out “Windows 3.1” in Chrome or Firefox or Opera (or any of your favourite browser):
http://www.michaelv.org/
It’s also implemented using JavaScript. 🙂
Neat, but it’s not actually Windows 3.1 that is running
Yeah, but it’s very different. It’s just mocking the Windows UI in JavaScript. It’s not an emulator which actually runs Windows code.
Yeah, bit if it was really Win 3.1 then you could never do this:
http://img8.imageshack.us/img8/5605/ieacid.png
The reason this is fast now is because of the skill of the person who created this and because JavaScript gained ‘binary array’-support from WebGL.
And the JavaScript JIT ofcourse. 🙂
The reason it was ‘easy to do’ in JavaScript is because Linux includes a FPU emulator, JavaScript isn’t particularly good at floating point if I can put it like that.
So I’m sure it saved a lot of time.
Edited 2011-05-18 07:21 UTC
even still, this is very impressive to say the least.
I remember when I used to fob off JS as a relatively useless scripting language, those days have well and truly gone!
The JavaScript language pretty much stayed the same, it was mostly the browser environment that was bad.
Most people who regularly deal with JavaScript know what the bad parts are and the good parts are. That means they just use the good parts and can do what they need to do.
Here a video of someone who knows:
http://www.livestream.com/etsy/video?clipId=pla_1463e546-47ed-4a93-…
There is a lot more here too:
http://developer.yahoo.com/yui/theater/
With recent development browsers are improving, more capabilities.
Although IE is still last and we still have the old versions of IE to think about (IE6 will be 10 years old in August this year and still has 4% of the worldwide marketshare).
I think when IE6 becomes 11 years old, it’s marketshare will have diminished close enough to 0, finally.
I’ll still be using it to fill out corporate timesheets — IE6 on Win2K in a VM to stay compatible with SharePoint. Legacy fades very slowly…
-p
I’m talking about visitors on the general web, not specific internal use at companies.
Sadly it’s internal workstations that make up the majority of lunch time traffic.
http://bellard.org/jslinux/ dosn’t work on IE9 BTW.
At least they’ve changed the fail screen to not say your webbrowser is too old.
It does work with IE9, at least mine (9.0.8112.16421) runs it fine.
Remember that this is a heavily performance-tuned Linux distro designed for running on low-power embedded system, though. QEMU always runs things pretty fast on modern hardware until you start to get into GUI stuff. And this thing doesn’t even have hardware floating-point calculations…
This is to say, sure it’s fast at booting, displaying a shell and compiling a hello world program, but whether this approach can scale to real-world applications remains to be seen. Remember that biolab disaster makes most modern CPUs reach their limits…
Edited 2011-05-18 08:37 UTC
JavaScript sure is awesome .
and the fact that it is written in *javascript* is just mind-boggling. I think “talented” might be an understatement.
It’s probably just me, but… what is the point?
Honestly, I also don’t get the point of using JavaScript to try to build desktop applications in a web browser.
From an academic point of view, JavaScript is a nice language, but I believe that it’s much more efficient to build those types of applications in for example C, C#, C++, Objective-C, Java.
All those fancy JavaScript applications are basically client-server applications, that use the web browser as their execution environment. Why is something like java webstart not used more? It can be used to run a client-server applications, it can be started from the web browser, and it downloads the needed libraries over the internet (so no installation/distribution problems on big deployments). What is it with everything has to run inside the browser?
It seems likes our powerfull desktop machines are only used to run a browser that hosts our new fancy javascript applications. It seems like going back to the central servers with several “dumb” x-terminals connected to it, with all of our data centralized on those servers. That is what we had ages ago. But back then, it was needed because it was too expensive to have machines that could actually run the software for everyone. Nowadays our machines are a lot more powerfull, but then we start to code our applications in javascript in a browser. Basically, you need a powerfull computer to run those web applications, even though in the end the client javascript code itself (mostly) doesn’t execute any business logic; the business logic executes on the central server. The client javascript code in the end is only used for presentation. And that is something that we had ages ago with X-terminals.
But anyways, I seem to be one of the few that feels that way.
Edited 2011-05-18 18:45 UTC
snowbender,
“All those fancy JavaScript applications are basically client-server applications, that use the web browser as their execution environment. Why is something like java webstart not used more?”
Someone else who sees the value of the most flexible platform ever made…thank you!
The reason it didn’t have widescale adoption was because of corporate politics and power plays.
For years, the large players have been drooling over “XYZ as a service” to replace “XYZ as an app”.
Technically, as we all should know, centralized services have far worse scalability characteristics than local/edge services. Centralized services require full time connectivity, use bandwidth unnecessarily, etc.
However it’s well documented that the microsofts, googles, apples want more control, so they deliberately promoted technologies which give them more control.
Google couldn’t mine emails for ads if you’re email client is an JWS app which lets us them out of the loop.
Microsoft was so horrified of the potential for java applets (compared to it’s own activex controls) that it used it’s embrace, break, extinguished maneuver against java.
Apple couldn’t sell a proprietary walled garden in a world where JWS apps are common, therefor it had every incentive to kill them off.
So, although Java Web Start solved many of the problems much better than javascript ever will, it was doomed to fail.
Edit: It seems plausible to me that active support of any one of these players could have brought JWS technology to the masses.
Edited 2011-05-18 20:12 UTC
It’s a shame that Java Web Start was killed but we have Silverlight which is still more powerfull than Javascript.
It is not. Silverlight is not cross browser or cross platform by any means. JavaScript is.
Only works in firefox4 and some version of chrome (so much for cross browser)
Modern JavaScript will catch up on all browsers. Silverlight won’t.
Silverlight runs on both Windows and Os X. Miguel De Icaza will implement Silverlight on iOs and Android. That means pretty much cross platform.
Not that being cross platform matters when you have more than 90% of users on one platform.
That can’t compare to the ubiquity of JavaScript anyway. Plus JavaScript is an open and free. Silverlight is patent encumbered and is owned by MS.
10% of 1 billion is still 100 million users.
(and that’s using a conservative estimate from 2009 of the number connected individuals).
Hence why comments like yours wind me up massively.
Edited 2011-05-19 12:01 UTC
Actually, Microsoft equivalent for Java Web Start is “Click Once”.. it’s basically the same thing as Java Web Start, but appeared a couple of years later.
Silverlight is basically the equivalent for Java applets. And personally, I also think Flash is an equivalent for Java applets.
I always hear those comments that Java applets never got popular because people don’t want to install a JVM.. but obviously people do want to install Flash..?
I am a Java programmer, but since a year have been doing 80-90% of my time on C# .NET development. And it just convinces me more about Java being superior. There’s a lot of things that Java had, and was the first to support, which were later copied by Microsoft. Especially in the context of Enterprise applications, with Java EE application servers. Those servers offer a bunch of features that you simple did not have in a nice package on a Windows platform. But more recently, Microsoft is trying to offer a part of those features in the form of WCF. WCF is comparable to Stateless, Stateful en Message beans. Then now with .NET 4, they have the Entity framework, which can be compared to Hibernate, JPA, Entity beans. Also more recently, Microsoft is focusing more and more on their build system MSBuild, which is heavily inspired by Ant.
I have to admit that there are also nice things on the Microsoft side. It is a fact that they added new features to the language much more agressively and that in turn lead to nice apis like LINQ. LINQ is really nice and leads to nice, concise, elegant code.
I do think that Sun could have gotten a lot more out of their Java platform. Maybe they should have been less ‘nice’ and more agressive….
“I always hear those comments that Java applets never got popular because people don’t want to install a JVM.. but obviously people do want to install Flash..?”
I think a flash usually comes preinstalled for most users buying a computer, doesn’t it? I know acrobat does because I uninstall that garbage from day one in favor of foxit.
The problem was that microsoft’s JVM in my experience was horribly buggy, whether that was intentional or not is debatable, but either way, it gave users a bad impression.
Adobe flash had two advantages, IMHO.
1. The company had much more pull with web developer audiences, many of who were already familiar with it’s products.
2. The flash editing suite included vector animation software, which was a prevalent form of media at the time. Java had no similar authoring tools which I am aware of. However Java was actually more popular than Flash for hosting applets in the academic world, where programming skills were less lacking.
Sidenote: One of the original versions of flash in the 90s was written to run atop java applets.
“There’s a lot of things that Java had, and was the first to support, which were later copied by Microsoft.”
I actually like .net, but it’s clear they ripped off a lot from java. The core .net framework is extremely nice, but I think ASP.NET is a mess.
“I do think that Sun could have gotten a lot more out of their Java platform. Maybe they should have been less ‘nice’ and more agressive….”
We can only speculate as to how much being “nice” contributed to their demise. Alot of the more successful companies are real jerks 🙁 .
*grin*.. heh.. i also use Foxit for pdfs.
The thing I remember is that Microsoft started to add Windows specific extensions in their JVM. As a result, Sun argued that this is no longer following the specs and that Microsoft’s Java/JVM can no longer be called Java.
I actually didn’t know all this about Flash. Interesting that an early version of Flash ran on top of a java applet.
I haven’t worked with ASP.NET actually. I only worked on the backend, the implementation of several WCF services. The thing that sometimes bothers me, is that .NET developers come to me and tell me how great .NET is. And, yes, there are a lot of nice things in the language C# and the framework, but they don’t seem to realise that a lot of all those things (the ideas and concepts) already exist for years in Java. Microsoft took a lot of those concepts, and certainly did improve on them in some cases for the implementation in .NET.
It also seems to me that the last 5 years, Java just stood still, while .NET is quite the opposite and advancing in high speed.
Yes… sadly, success is not only determined by the technological quality of a product.
To see if it could be done.
Because he likes a challenge.
Who cares why?
The purpose of the PC emulator in JS is just fun for the developer. Just like running linux on a console.
However there is a purpose in using JS for “desktop” applications, particularly in the enterprise. I don’t care for Google or MS having control of all my documents but if your server is within your own datacenter, a web app has several advantages over a desktop app:
– No distribution: PCs come with a browser, just put a link to your web app on your intranet and all of your employees can use it, regardless of what computer they’re on. Heck they might even be able to use it from home.
– Easy to back up data: assuming it’s an app that saves files, those are now saved in a central location on a server which can be backed up regularly and more easily than a bunch of PCs.
– Multiplatform: your web app will run on Windows, Mac or Linux and maybe even on mobile devices if done well. And again you don’t need management software to handle all of those platforms.
Javascript is quite a pain to use for large projects though that’s why Google came up with GWT. I personally like to use Script# but that’s not for everyone. What would be awesome is something like Silverlight has but standard across browsers: a bytecode VM so that developers could use their language of choice. But that’s just me dreaming.
-No distribution: that’s what Web apps are for. And I think that some JSP/Java or ASP.NET/Silverlight solutions are more powerful
-cross platform does really not matter
twitterfire,
“-No distribution: that’s what Web apps are for. And I think that some JSP/Java or ASP.NET/Silverlight solutions are more powerful”
You say “no distribution” is what web apps are for, but to be fair you should be comparing it to state of the art operating systems (a collection which windows is notably absent from).
“No distribution” was achieved many many years ago by sun workstations. My school’s CS labs were sun workstations. I could walk up to any computer in any lab and log in with all my customized applications ready to go. What I did under my account wouldn’t affect the next user, my files were secured.
Javascript running in a browser looks terribly weak in comparison.
“-cross platform does really not matter”
Hmm, I don’t know how you can say that, particularly in the browser space. The whole reason for HTML standardizing efforts is to improve portability between browsers. Why doesn’t it really matter?
Maybe I’m just being grumpy, but I don’t understand the hype behind web apps. This “new technology” is several thousand times slower than the old technology doing the same thing.
I guess this has merit on account of being able to run on a walled garden device. But our heading is taking us down a path of net loss compared to just a couple years ago.
Edited 2011-05-19 02:27 UTC
Mounting the /home dir via NFS is different then no distribution. You still had to put the apps there and update them as necessary.
There is not an operating system that does the no distribution thing for applications. I can’t install an application on one device and have everyone assigned to it launch it immediately from a link. You can do this with Citrix, and probably some other VDI stuff, but there is nothing capable of the same thing out of the box.
Then you don’t run several different applications across several different platforms. It really sucks trying to sync data across different devices.
The hype is not having to setup a server yourself and deal with the telcos being stingy with the upstream bandwidth. Bandwidth really is crux of the issue. Upstream speeds are so limited it makes serving stuff from your house unattractive. (Unless you can get FiOS from Verizon.)
“Mounting the /home dir via NFS is different then no distribution. You still had to put the apps there and update them as necessary.”
Yes that’s a fair point, however in my defense I was talking about windows limitations for doing the same thing. Windows applications like office or visual studio need to be installed on each machine.
“There is not an operating system that does the no distribution thing for applications. I can’t install an application on one device and have everyone assigned to it launch it immediately from a link.”
Java Web Start worked almost exactly like that.
I think Sun’s Java Desktop System did work that way too, but I only had very little experience with it a long time ago.
“You can do this with Citrix, and probably some other VDI stuff, but there is nothing capable of the same thing out of the box.”
WindowsNT terminal services does that too, and though I think the new protocols are superior, unix systems have long had the capability to run remote desktops out of the box. It was very useful for us as students to run individual apps or even our entire desktop remotely.
Never the less, sending screens over the wire is an example of poor utilization of resources.
“Then you don’t run several different applications across several different platforms. It really sucks trying to sync data across different devices.”
Which goes back to the benefits of network filesystems. There is certainly room for innovation, but windows is generally far behind the state of the art.
<tangent>Windows kernel DRM effectively bans open source development, and that has retarded file system innovation on windows. The situation on windows is awful for open source. Take a look at the Andrew FS client for windows, it has to emulate an SMB server to get around the stupid windows kernel DRM limitations.</tangent>
“The hype is not having to setup a server yourself and deal with the telcos being stingy with the upstream bandwidth. Bandwidth really is crux of the issue.”
I don’t buy this at all. In fact if I’m an XYZ as a service provider, I might even want to downplay the fact that I need Internet connectivity for everything I do. What happens to an online CRM package when the internet is slow/broke? Business stops.
No, the hype is about easy management. And while I agree that a website can be easy, the main reason FAT apps are considered to be difficult is because the predominant operating system handles it so poorly.
no distribution
This is the most important argument I guess. But.. you have the same advantage with Java applets/JavaWebStart, or Silverlight/ClickOnce. I know the argument with those is that you have to install something extra.
easy to backup
I know that argument too, but this is something that you have with every client-server application.
multiplatform
Java applets
I give those arguments, but I know that companies are probably gonna demand javascript applications. But see… with GWT.. you actually program in Java, to compile it to JavaScript, that you run on a browser, which contains a very fancy JavaScript interpreter to make it run as fast as possible. All that while there is basically a technical solution (applet/JWS) that let’s you program in Java and compile it straightaway and run it on a very performant and mature JVM.
snowbender,
I had never heard of “ClickOnce”. I heard that .net had something like it in passing, but I totally forgot about it.
The windows kernel driver DRM in vista and win7 totally turned me off the OS. Since I stopped using Windows as my primary desktop, I haven’t really kept up with many new developments on that side of the fence.
“I give those arguments, but I know that companies are probably gonna demand javascript applications”
Yes, I know they do. A company of mine was involved in a major conversion of a client mainframe application to asp.net. The web version was fancy enough, but the paging latency went from around 20ms to 500ms.
Of course the web version is doing much more processing, but it sucks that paging through 10 screens takes 5 seconds now instead of < 1s.
Even microsoft couldn’t improve it.
Sometimes old is better.
The last couple of months we’ve been developing a client-server application for a customer in .NET. (The customer is basically a Microsoft-only company.) The backend consists out of 5 WCF services and the frontend is a desktop application. The drawback is that the desktop client needs to be installed separately by someone with administration rights on each of the desktops (only 5 users though). A colleague told me that maybe we should look into ClickOnce. That is also the first time I actually heard about it… When I read about what it is, it made me think about JWS rightaway.
My main OS at home has been linux since around 1997. I did respect Windows 2000 though, I still think that was a really nice OS. And the DRM in recent Windows versions.. yeah.. also turning me off. What is really pissing me off, is that those big companies always succeed in forcing locks on customers (who don’t know any better), while telling them with a straight face that it is all because of the better quality. Examples… HDMI-HDCP instead of DVI.. another example I saw recently: Adobe PDF Digital Editions.
When you read the explanation of that format as a normal customer… it’s a special pdf that is highly optimised for reading ebooks and therefore you need to install special software. When you go find information about it as a technical person: it’s a normal pdf with locks attached, and you need to use special software to read it so that Adobe can keep track of which devices you are using to read that pdf.. so they can limit the number of devices you are reading it on (or revoke your right to read an ebook after you purchased it). It is really pissing me off that companies can tell a customer with a straight face that it’s a better quality pdf, while making the customer pay (indirectly) for the handcuffs they put him in. Exactly the same thing that happened with HDMI… monitors that supported it were more expensive (than DVI), because of the additional encryption hardware builtin, but to the customer no word about that.. nah.. it is more expensive because it is “better quality”.
Exactly! In a lot of companies there are a lot of “data-input” applications. With the old-fashioned client-server applications, it is sometimes amazing how fast the people in those companies work. They use the keyboard only to navigate through the different fields and enter data. Many of those applications also connected straight to the database instead of going through for example WCF. There is simply no way a re-implementation as a fancy web application is gonna work as fast as a native client-server application.
snowbender,
Well, I hear you…but what can I do?
I’m just a nobody struggling even staying employed.
http://downloadsquad.switched.com/2007/03/26/java-based-x86-emulato…
Of course, now that most web browsers don’t have java installed anymore it’s of little value.
Doom in an applet is impressive
Nope. Playing Quake 2 in browser is much more impressive.
http://playwebgl.com/games/quake-2-webgl/
twitterfire,
“Nope. Playing Quake 2 in browser is much more impressive.”
(The server seems to be down?)
That’s certainly true. However there are significant differences. The quake game engine was re-engineered to run over a the webgl graphics system, so it’s not technically using the original quake rendering engine.
The java emulator, on the other hand, can emulate any x86 os/application which ran on a compatible PC. It’d be fun to see the java applet emulator running the original quake engine.
Pretty soon java will be nothing more than a historical footnote.
Edited 2011-05-19 02:51 UTC
I really hope not. I guess you are also not very happy with Sun going down?
I think there were a lot of worried people after Oracle took over, but I do think that nowadays, interest in Java is getting higher again. It seems there are more Java books coming out in the next months. There’s a lot of talk about Java 7. Maybe it’s just me, but Java seems much more alive again since the last couple of months.
I’ve run JPC before (which used FreeDOS to run games, e.g. original 2D Duke Nukem), but it’s fairly slow. However, one guy recently “ported” DOSBox 0.74 emulator to Java, and it runs Doom at full speed for me (with sound!). Quake 1 runs too but slower. Granted, you could always say it’s not “real” DOS, but the binaries are!
http://jdosbox.sourceforge.net/
http://jdosbox.sourceforge.net/beta/quake.html
http://www.classicdosgames.com/online.html
http://vogons.zetafleet.com/viewtopic.php?p=227202#227202
Now just try to tell me this isn’t awesome? 🙂
Rugxulo,
“I’ve run JPC before (which used FreeDOS to run games, e.g. original 2D Duke Nukem), but it’s fairly slow. However, one guy recently “ported” DOSBox 0.74 emulator to Java, and it runs Doom at full speed for me (with sound!). Quake 1 runs too but slower. Granted, you could always say it’s not “real” DOS, but the binaries are!”
I say DOSBox counts, as would a Wine implementation in the browser if it existed.
This really is an unusable deal right now. I think the world of qemu and bellard’s work but we have a much better JPC emulator (java not script).
Still waiting for a JVM implementation in Javascript.
j.dairymple,
“Still waiting for a JVM implementation in Javascript.”
It would make for an interesting project. But what would be the point? It’d clearly be better to install a native JVM instead.
I guess it may help to get around restrictive DRM on certain mobile devices though.