DEV Community

Bharath Muppa for Entangled Cognition

Posted on

Chrome Multi-Processor Architecture

In this article, I would like to share my experience, which I came across accidentally while killing a task, I found below the list of Google chrome tasks, though I have opened like 4–5 tabs.

Chrome browser

So, I have tried to find out what is happening with this chrome processes. I started with our favorite Google Search and within minutes I came to know that reason is fairly simple.

It is because of Chromium Multi-process architecture and its S-speed, S-secure and, S-safe principles.

So, let’s start our quest of questions about what leads to this design and why is this even required.

Different types of Processes in chrome

  1. One Browser process β€” This process is created when we start the Browser.
  2. One GPU process.
  3. One Process per Utility.
    • πŸ‘‰Network service Utility β€” responsible for chrome detecting casting devices.
    • πŸ‘‰V8 proxy Resolver β€” Not sure about this. something to do with PAC file.
    • πŸ‘‰Audio Service Utility β€” helps to play audio 🎡 on the browser. for more info check this out β†’ chrome://media-internals/
    • πŸ‘‰Windows Utilities β€” this process will be created when the user open file explorer while saving or uploading files
  4. One process per Tab β€” Every site you visit creates a new process. (more than 20 tabs leads to a different behavior)
  5. One Process per sub-frame β€” subframe is a frame or iframe element inside a web page.
    • πŸ‘‰ Frames share a process with their page if the frame and the page are from the same site (based on the URL).
    • πŸ‘‰Frames from cross sites create a new process.
  6. One process per extension β€” Which you installed on chrome.

πŸ”­ Shortcut to check chrome task manager
(shift + esc) or Menu -> More tools -> Task manager

Alt Text

You can disable this multi-processes behavior using launch parameter --single-process. πŸ”—

πŸ“’ This is just to simulate single process behavior, but don’t make it as default. As your site behaves really strange once user uses it in real environment.

c:\path-to-chrome\chrome.exe  --disable-plugins --single-process
Enter fullscreen mode Exit fullscreen mode

πŸ”₯ Firefox Facts

  • Firefox worked on an internal project called Electrolysis to implement Multi-Process Architecture. To know more please read Electrolysis or e10s.
  • FireFox released new versions with multi-process architecture but it is not the same as chrome.
  • Firefox nightly builds ships with fission which enables site isolation.

🌐 IE Facts

  • IE's multi-process architecture was introduced with IE8. It makes use of two types of processes
    1. One main process
    2. Zero or More Tab processes(based on configuration)

Till now we understood about what / when processes are created. Now we will ask our-self a quite interesting question.

But Why we need a multi-process Architecture ?
πŸ€” Take time to think before you go through the explanation. πŸ€”

Benefits of Multi-process Architecture in a nutshell

Extracted from google

  1. Sand-boxing β€” Important aspect of security mechanism, which in simple terms says your code will run in its own process. So your creativity doesn’t bother other's creativity. want to know more? ( πŸ‘‰ πŸ”—)
  2. Black Sheep Detection 😝 β€” If one of the pages is unresponsive, then the browser can easily delete that particular process and saves the life of User. (Definitely, you might have faced one, while processing Bank transaction and suddenly browser crashes..)
  3. Optimal memory footprint β€” Helps in setting priory on tabs which are not active.
  4. Private Data β€” Web pages will have their own memory. By now, you must understand why stored objects in local-storage on one tab doesn’t available in another tab.
  5. Site Isolation β€” When Site Isolation is enabled, each renderer process contains documents from at most one site. This means all navigation's to cross-site documents cause a tab to switch processes. (πŸ‘‰ πŸ”—)

Extracted from google


Its Time for Next Important question …

How does this mechanism work?

Prior knowledge of Browsers is an added benefit to understanding this mechanism.

Alt Text

I will try to summarize this mechanism in my perspective. πŸ˜…

Let’s assume, below steps were performed by you to watch a YouTube video and Twitter page on an exciting day.

  1. You have opened a chrome browser.
    • πŸ‘‰ A browser process will be created and two threads namely main/UI and IO threads are created.
    • πŸ‘‰ Browser process will check for all extensions and create one process per extension.
  2. Type youtube.com in your URL bar.
    • πŸ‘‰ The browser will check whether it is a search query or URL. If it is URL, it will be passed to IO thread (Network handling happens here).
    • πŸ‘‰Then ResourceDispatcherHost(This object will be there in IO thread) checks for valid network response and pass it to main/UI thread.
    • πŸ‘‰ Then UI thread request to create new Render process and maps that process with RenderViewHost(This object will be there in Main/UI Thread of browser process), which creates 2 new threads in corresponding render process namely Main Thread and Render thread*.
    • πŸ‘‰ Main thread uses for inter-process communication.
    • πŸ‘‰ Render Thread consists of all Blink and v8 implementations(this is the place where all exciting stuff happens).
  3. Type twitter.com on a new tab. πŸ‘‰ sub-steps in step-2 will be repeated. πŸ‘‰ a new instance of RenderViewHost will be created to handle this tab within the same browser process.

If you want to explore more about it, then I strongly suggest you to visit Chromium’s official docs πŸ”— or this medium post πŸ”—.


I hope now we can answer the below questions.

  1. What are the different types of Processes? βœ”οΈ
  2. When they are created?βœ”οΈ
  3. Why is it required?βœ”οΈ
  4. How this Mechanism Works. βœ”οΈ

Learned something? help others find this article.

References

Top comments (0)