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.
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.
- One Browser process — This process is created when we start the Browser.
- One GPU process.
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
- One process per Tab — Every site you visit creates a new process. (more than 20 tabs leads to a different behavior)
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.
- One process per extension — Which you installed on chrome.
🔭 Shortcut to check chrome task manager
(shift + esc) or Menu -> More tools -> Task manager
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
🔥 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
- One main process
- 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. 🤔
- 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? ( 👉 🔗)
- 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..)
- Optimal memory footprint — Helps in setting priory on tabs which are not active.
- 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.
- 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. (👉 🔗)
Its Time for Next Important question …
Prior knowledge of Browsers is an added benefit to understanding this mechanism.
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.
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.
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).
- 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.
- What are the different types of Processes? ✔️
- When they are created?✔️
- Why is it required?✔️
- How this Mechanism Works. ✔️
Posted on Apr 16 by: