Web browsers are limiting the benefits of multi-core CPUs.

When it comes to purchasing consumer-grade PCs these days, it’s rare to find a system with a CPU that only has a single core. Most laptops even offer a dual-core CPU. So as software developers, we’re entering a unique era where we can start to employ parallelism in ways that would not have been practical before. In some cases, we will need to exploit this parallelism if we hope to increase the performance of our software.

Unfortunately, we are also seeing a move towards the development and use of Web-based applications. These are applications that are hosted on a remote server, and provide an HTML- and AJAX-based interface that is accessed via a Web browser.

These Web browsers attempt to give us some degree of parallelism, often through tabbed browsing. While this works great for relatively static content, we experience problems with JavaScript scripts that run for anything longer than 500 ms or so. Since the computation of all of the tabs is performed within the same (main) thread of the browser, a long-running JavaScript script immediately locks up all of the other tabs.

The solution is quite clear: each browser tab should have its own thread, in which a separate instance of a JavaScript interpreter executes. A long-running JavaScript script in one tab (ie. one that runs for 2 to 3 seconds, if not more) will not prevent, at the very least, the user from switching to an alternate tab and continuing to work there.

Of course, most Web browsers today just aren’t prepared for such an architectural change. And considering how large of a job it is to write a high-quality browser, it seems unlikely that we’ll see a Web browser written from the ground up that better supports the benefits offered by the now-prevalent multi-core CPUs. So it’s quite unfortunate that we have all of this processing power available to us, but it can only be exploited to a limited degree because developers are choosing to write JavaScript-based applications that execute within parallelism-unfriendly Web browsers.

You can skip to the end and leave a response. Pinging is currently not allowed.

One Response to “Web browsers are limiting the benefits of multi-core CPUs.”

  1. Rambo Tribble says:

    You’re focusing too high on the software stack. When the underlying layers provide better access to parallel processing, browsers will soon take advantage. Want to a write a browser engine in Erlang, anyone?

Leave a Reply

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word