Tuesday 6 June 2017

Why does Google Chrome creates different process every time we open a new tab, isn't it a bad thing as it consumes very considerable amount of RAM?

Why does Google Chrome creates different process every time we open a new tab, isn't it a bad thing as it consumes very considerable amount of RAM?
To understand why Chrome uses so much memory, you need to understand a bit about what makes Chrome different from other browsers. Every app on your computer runs a number of processes in your computer’s RAM, where the hard work of running your computer is done. RAM is temporary storage for data, and it’s very fast; your CPU can access the data that’s there much faster than it could pull the data off of your hard drive.
What makes Chrome’s use of RAM unique is that it stores every tab, plugin, and extension in a different RAM process. This is called process isolation, and it prevents one process from writing to another one. This is why you see a ton of different entries for Chrome when you open up Task Manager or Activity Monitor on your computer. Each of these processes only uses a small amount of memory, but when you add them up, the load can be very high.
Why does Chrome use RAM in this way? It has to do with stability and speed.
By running each process separately, if one of them crashes, the entire browser remains stable. Sometimes a plugin will fail, for example, and that will require that you refresh the tab. If every tab and plugin was run in the same process, it could require that you close and reopen the whole browser, instead of just the tab.
This means that some processes that single-process browsers are able to share between tabs need to be replicated for each tab in Chrome, as shown in the image below. This comes with some security benefits, however, much like sandboxing or using a virtual machine do. For example, if a JavaScript attack takes place in one tab, there’s no way for it to get to another tab in Chrome, whereas it might be able to do that in a single-process browser.
In addition to the tabs, plugins, and extensions, a few other processes also use RAM, with pre-rendering being a notable example. Pre-rendering lets Chrome start loading up a webpage that it predicts you’ll go to next (it might be the top search result from Google, or the “next page” link on a news site). This requires resources, and so uses more RAM, but it can really speed up your browsing experience if it’s working well.
If it’s not working well, it can slow everything down by taking control over too much of your RAM.