Mozilla today announced a collaboration with Samsung to produce a new browser engine designed to take full advantage of processors with multiple cores.

For the last couple of years, Mozilla Research has been developing a new programming language, Rust, that's designed to provide the same performance and power as C++, but without the same risk of bugs and security flaws, and with built-in mechanisms for exploiting multicore processors.

Using Rust, the company has been working on a prototype browser engine, named Servo.

Rust's safety features aim to eliminate many kinds of memory corruption bugs that are currently abundant in C++ programs, such as trying to write more data to buffers than the buffers can contain, or trying to use blocks of memory even after they've been deallocated. Unlike many other safe languages (such as C# and JavaScript), Rust still compiles to native code, so it should provide performance that's comparable to C++.

The language has built-in concurrency features to make it easier to produce both task-parallel programs (those that do different things on different data on different cores) and data-parallel programs (those that do the same thing to different data on different cores). These concurrency features mesh neatly with the safety features by making data sharing between threads more explicit.

Rust 0.6, released today, contains contributions from Samsung that port the language to ARM processors and the Android operating system.

Current browser engines are substantially single-threaded. Though some tasks such as decompressing images are starting to be done on separate processor cores, the bulk of the work of interpreting HTML and laying out pages is single-threaded. This limits the scalability of browser engines on the current proliferation of multicore processors. The ability to scale to four or more cores is increasingly attractive, with even smartphone processors containing lots of cores.

Browsers do allow certain kinds of parallel programming today. WebGL shader programs execute in parallel on GPUs, and Web Workers in JavaScript also allow parallel computation. With Servo, Mozilla is attempting to produce a browser engine that uses parallel processing for plain HTML and CSS too, ensuring that all developers—not just those producing WebGL/JavaScript programs—can take advantage of parallel processing.

As Mozilla learns more from its experience with Rust and Servo, this could then feed back into the designs of future versions of HTML and CSS to make them more amenable to this kind of engine.

Samsung, of course, has many fingers in many pies. It produces smartphones running Android and Windows Phone, it has developed its own smartphone operating system (Bada), and it is now folding that work into the HTML5-based Tizen, codeveloped with Intel. The company is keeping its options open.

On why it's contributing to Rust and Servo, a Samsung spokesman said, "As a leading mobile/TV manufacturer, Samsung is investigating various new technologies to innovate legacy products. This collaboration will bring an opportunity to open a new era of future web experience."

Servo is, at the moment, still a research project. We're not going to be running Servo-based browsers any time soon, and for the foreseeable future, Mozilla will be sticking with its C++ Gecko engine. But a few years from now, Servo, or something like it, could find itself at the core of the browsers we all use and depend on.