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.
Different types of Processes in chrome
- 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. π€
Benefits of Multi-process Architecture in a nutshell
- 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 β¦
How does this mechanism work?
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.
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.
- What are the different types of Processes? βοΈ
- When they are created?βοΈ
- Why is it required?βοΈ
- How this Mechanism Works. βοΈ
Top comments (0)