Why the browser uses a multi-process architecture

Source: Internet
Author: User

http://blog.csdn.net/ithzhang/article/details/7917754

When using a browser, I stumbled across a single tab, but in Task Manager I found that there were multiple browser processes running, which took up a lot of memory, and wondered: why does a browser need multiple processes? Inadvertently found this article on the Internet, Google Chrome as an example, explains the use of multi-process architecture of the browser . Translation to everyone, hope to have English reading difficulties of the students have help, the first translation of technical articles , Many terms do not understand what meaning, also did not search is based on understanding of translation. such as cross-site frame, if there is an error, please correct me.

Original Address:

Http://blog.chromium.org/2008/09/multi-process-architecture.html

Browser's Multi-Process architecture

Unlike many of today's browsers, Google Chrome uses multiple processes to isolate different pages and your computer. In this blog I will explain why the use of multi-process architectures under current network conditions is a huge improvement. I'll also discuss what the different parts of the browser belong to and under what circumstances Google Chrome is creating a new process.

1: Why use multiple processes in one browser.

When the browser was just designed, then the page was very simple, with little dynamic code. This can be useful for rendering all the pages you want to access using only one process, but still maintaining a very low resource share.

Today, however, we see a large number of pages turning to dynamic Web pages, from Web pages with lots of JavaScript and Flash to fully fledged Web applications like GMail. A large part of these apps runs in a browser, just like an application running on an operating system. Like the operating system, browsers have to separate these applications from each other.

      In addition, the browser is responsible for rendering html and cssbug, some bug

in today's world, browsers that put everything into a process face challenges in robustness, responsiveness, and security. If one of the Web apps in the browser crashes, this affects any other apps, including all open apps. Single-threaded Web applications often have to compete with each other to get CPU time, which sometimes causes the entire browser to become unresponsive. Security is equally important, because just one page can take advantage of a vulnerability in the rendering engine to gain control over the entire computer.

However, this is not a must. Web applications are designed to run independently and in parallel in the browser. They do not require access to disks and devices. These security policies, which are applied to the network, ensure that you do not need to worry about the security of your data and your computer when you visit most of the pages. This means that applications in the browser can be completely isolated from each other without destroying each other. For plugins like Flash in the browser , they are loosely coupled with the browser and isolated from each other, and there is no problem.

Google Chrome takes advantage of this feature by putting plugins or web apps in a different process than the browser itself. Crashes in one rendering engine do not affect the browser itself or other Web applications. This means that the operating system can run network applications concurrently to improve responsiveness, and the browser itself will not be deadlocked if a particular network application or plug-in stops responding. This also means that we can run the render engine process in a strict sandbox, helping to reduce the loss caused by the error.

Interestingly, using multiple processes means that Google Chrome can have its own task manager, which you can open by right-clicking the browser's title bar. This task Manager allows you to track the resource usage of each Web application and plug-in instead of the entire browser.

It also allows you to terminate any Stop Response Network app or plug-in without restarting the browser.

For these reasons,Google Chrome 's multi-process architecture is more robust, faster responsive, and more secure than a single-process browser.

2: What is in each process.

Google Chrome creates three different types of processes: The browser process, the renderer process, and the plug-in process.

Browser process: There is only one browser process for managing tabs, Windows, and the browser itself. This process is responsible for all interactions with disk, network, user input, and display, but it does not parse and render any page content.

      renderer Process: The renderer process creates multiple processes, each of which is responsible for rendering the Web page. The renderer process contains the operation html,javascript,css,apple safari Open source for browser use The rendering engine implements the above functions. Each renderer process runs in the sandbox, which means that it has no direct access to disk, network, and monitor. All interactions with Web applications, including user input events and screen drawing, must pass through the browser process. This allows the browser process to monitor the renderer's suspicious behavior and terminate it once it discovers that it is engaged in a destructive activity.

Plug-in Process: The browser process also creates a process for each type of plug-in that is in use, such asFlash,Quicktime, or Adobe reader. These processes contain only the plug-in itself and the glue code that interacts with the browser process and renderer process.

3: Under what circumstances the browser will create the process.

Once Google Chrome has created a browser process, it typically creates a renderer process for each site you visit. This approach is designed to isolate different pages of different sites from each other.

You can think of this: the browser uses a different process for each label page, but allows two related web pages that belong to the same site to share the same renderer process. For example, if you open another tab that also uses JavaScript , or you open a new tab page that belongs to the same site, the tabs will share a renderer process. This allows pages in these tabs to communicate through JavaScript and share cached objects. Conversely, if you enter a URL for a different site in the Address bar of the tab , the tab will be swapped to a new renderer process.

      maintaining compatibility with existing pages is very important to us. Based on this, we define each site as a or bbc.co.uk Register the domain name, which means we can think of like and maps.google.com< Span style= "font-family: the song Body;" The same sub-domain name belongs to the same site. This is necessary because of the existence of a label page belonging to a different subdomain through javascript Communicating with each other, so we let them use the same renderer process.

However, there are the following considerations for this basic approach. If you create too many processes, the performance of your PC degrades, so we limit the maximum number of rendering processes created (in most cases ). When this limit is reached, we will reuse the existing renderer process for the New tab page. As a result, the same renderer process can be used for multiple sites. We do not place cross-site access in the original process, nor do we exchange all types of cross-site navigation to the new renderer process. For now, we are simply swapping the navigation of the browser process itself to the new tab process. Despite all the caveats, Google Chrome will isolate different sites from each other in the usual use.

For each type of plugin,Google Chrome creates a plug-in process when you first visit a webpage that uses the plugin. The process will only be revoked if all the pages that use the plugin are closed.

With our further refinement of the process strategy for creating and exchanging renderers, we will publish more blogs. At the same time, we want to experience many of the benefits of multi-process builds when you use Google chrome.

Why the browser uses a multi-process architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.