Multiprocess Firefox

    Since January of this year, Bill McCloskey, together with David Anderson, have been working to make Firefox a multiprocess, they were helped by Tom Schuster (evilpie), Felipe Gomez and Mark Hammond. And now the moment has come when they would like to know the community's opinion on the work done .

    Firefox has always used a single-process building model. The interest in changes in the field of parallelization spurred the output of the Chrome browser, it used one process for the interface and separate processes for working with the content of web pages. (Nevertheless, six months before Chrome, several processes started using Internet Explorer 8.) Soon, several other browsers followed the example of Chrome, and Mozilla launched the Electrolysis project.to adapt the Gecko engine to the use of several processes.

    What makes Mozilla switch to a similar model for building its browser? First of all, it is performance and responsiveness. The main goal is to reduce jank, which manifests itself during standard operations - loading a particularly large page, typing in a web form or scrolling overloaded with page elements.

    Responsiveness today is somewhat more important than performance. Part of the work was carried out as part of the Snappy project . The main tasks were:

    • Moving long operations to a separate thread so that the main process remains responsive.
    • Implement asynchronous I / O so that the main process is not blocked by disk operations.
    • Splitting long operations into parts with an event loop between them. An example of this is the parallel garbage collection.

    The simplest of these tasks have already been completed; now the most difficult ones remain.

    Another need is safety. Now, after detecting an unclosed bug in Firefox, an attacker can execute arbitrary code on users' machines. A lot of techniques and techniques are used to solve security problems, but the most effective is to run the code in the sandbox.

    However, placing the current single-process Firefox architecture in the sandbox does not seem effective: the sandbox mode only prevents the process from performing actions that it should not do, and the current Firefox organization (especially with many additions) requires wide access to the network and file system. The multiprocess Firefox will provide the operation of each of the web content processes in sandbox mode with deep restrictions, which, as the developers hope, will reduce the number of vulnerabilities in the browser. Access to the file system will be controlled by the main process.

    In addition, the developers tried to increase the stability of the Fire Fox, even though Firefox remains the most stable browser in the world.. Instead of dropping the whole browser, only the process responsible for a particular tab or element will fall.

    Already now you can try to see what happened. To do this, just download the nightly build of the browser and set the parameter browser.tabs.remoteequal true. Developers strongly recommend creating a new profile. about:memoryalready displays consumption for individual processes.

    This is what the Firefox multiprocess window looks like. The underlined name of the tab reflects the fact that its content is processed in a separate process.



    So a separate tab falls.



    The first question that most people have is related to RAM consumption. Users are convinced that more processes mean more memory. The developers promise a number of optimizations and the introduction of certain types of cache common to several processes. If in one of them there is any data written by one process, the other process will be able to check its presence and use the data from this cache instead of creating new ones in its memory area. Such a model will allow both to increase security and maintain some performance.

    Using the MemBench benchmark and after opening 50 tabs, memory consumption compared to the usual single-processor version increased by only 10 megabytes (from 974 megabytes to 984 megabytes). Over time, this difference will become minimal.

    At the moment, it remains unknown when the multi-process Firefox will reach the release stage - the developers have too much work to do. Details of the new architecture are reflected in the publication of Bill McCloskey .

    Also popular now: