Google Chrome browser multi-process architecture

Three-tier computer architecture

The hardware is at the bottom, the operating system OS is in the middle, and the applications are at the top.
Insert picture description here
When the application program on the computer or mobile phone is started, the CPU and GPU provide strong support for the application program. The application program uses the mechanism provided by the operating system to run on the CPU and GPU to implement the corresponding function on the underlying hardware.

GPU (Graphics Processing Unit), graphics processing unit, is good at processing simple tasks and can span multiple cores at the same time. In graphics processing, the words "use GPU" or "GPU support" usually mean fast rendering and smooth interaction.

Process independent, preventing the entire system from crashing

Process and Thread

A process can be understood as an execution program of an application program, and a thread exists inside the process, and can be understood as a certain function function, and executes some functions of its process program.
The process serves as the boundary of the thread, and the thread is like a fish swimming in the process.
Insert picture description here
A process can start another process to perform different tasks through the operating system. At this time, the system will allocate different memory spaces for the new process. If two processes need to communicate, they can use IPC (Inter Process Communication) inter-process communication mechanism for communication.
Insert picture description here

Google Chrome / Chromium's multi-process architecture

Google Chrome is the first browser to adopt the concept of multi-process browsing, and has a complex system for isolating each component of the browser.

In Chrome, Google uses the out of process plugins (OOPP) function to isolate all plug-in processes from the browser process. Even if a plug-in crashes and cannot be used, it will not affect the operation of other plug-ins and the entire browser, thereby improving Chrome Browser stability.
Insert picture description here

Four main process types and functions

  • Browser process (Browser), used to handle the user interface and manage all other processes, running at the top level of the browser;
  • Renderer (Renderer), used to handle the rendering in independent browser tags, a rendering process can handle multiple tags;
  • Plug-in process (Plugin), each browser plug-in runs in its own independent process, these plug-in processes can communicate with their respective rendering processes;
  • Extension process (Extension), the extension in the browser also has its own independent process to avoid mutual interference.
    Insert picture description here

Service and site isolation

Chrome service, more memory saving

Probably means to run each part of the browser program as a service, and then according to the situation, to split it into different processes or summarize into the same process, it is a dynamic allocation of resources integration.
If the computer's performance is powerful enough, when the browser runs on powerful hardware, each service may be split into different processes, thereby providing higher stability. However, if this condition is not met, device resources are constrained, and multiple services may be integrated into a process, thereby saving memory usage.Insert picture description here

Site isolation, independent rendering process

A separate renderer process can be run for each cross-site iframe.
Each tab has an independent renderer process, which allows cross-site iframes to run in a single renderer process and share memory space between different sites. You can run a.com and b.com in the same renderer process. The same-origin policy is the core security model of the network. It ensures that one site cannot access the data of other sites without consent. Bypassing this policy is the main target of security attacks. Process isolation is the most effective way to separate sites. (Still understand the picture)
Insert picture description here
Reference source: https://juejin.im/post/5bd7c761518825292d6b0217#heading-6

Published 13 original articles · Like 3 · Visits 4186

Guess you like

Origin blog.csdn.net/qq_39111085/article/details/103776844