Executing program on Process and Thread
The Operating System gives the process a “slab” of memory to work with and all application state is kept in that private memory space. When you close the application, the process also goes away and the Operating System frees up the memory. A process can ask the Operating System to spin up another process to run different tasks.
If two processes need to talk, they can do so by using Inter Process Communication (IPC) . Many applications are designed to work this way so that if a worker process get unresponsive, it can be restarted without stopping other processes which are running different parts of the application.
So however, may be a applications program designed exploitation processes and threads? Well, it may be one method with many alternative threads or many alternative processes with many threads’ communication over IPC.
There is no customary specification on however one would possibly build an internet browser. At the highest is that the browser method coordinate with different processes that lookout of various elements of the applying. For the renderer method, multiple processes are created and appointed to every tab. Until terribly recently, Chrome gave every tab a method once it could; currently it tries to administer every website its own method, together with iframes.
Browser :- Controls part of the application including address bar, bookmarks, back and forward buttons. Also handles the invisible, privileged parts of a web browser such as network requests and file access.
Renderer :- Controls anything inside of the tab where a website is displayed.
Plugin :- Controls any plugins used by the website, for example, flash.
GPU :- Handles GPU tasks in isolation from other processes. It is separated into different process because GPU handles requests from multiple apps and draw them in the same surface.
Chrome was the first browser with a multi-process architecture. Put simply, it encapsulates all logical functions in separate processes. More specifically:
- One main (browser) process
- One GPU process
- Each tab: dedicated process
- Each extension: dedicated process
Chrome is the only browser with a useful task manager. It can be opened with the keyboard shortcut SHIFT+ESC. As you can see below, Task Manager lists all active Chrome processes with their designated functions. For each process, it shows CPU, network and memory resource usage. It also indicates whether frames are hosted in their page’s process or in dedicated processes (more on that below). Finally, Task Manager shows the Windows OS process ID, which makes it possible to correlate data with other system information tools.
Mozilla started project Electrolysis as a gradual move to a multi-process architecture. This took 9 versions, from Firefox 48 to 56. The current architecture looks like this:
- One main process
- One GPU process
- One extension process
- Up to 4 content (tab) processes
The current default of 4 content processes might be changed in future versions. At this point, it can be increased to a maximum value of 7 content processes. Work is underway to encapsulate extensions in dedicate processes.
chrome uses multiprocessing and firefox uses multi threading. so each tab in chrome is a process whereas in firefox each tab is a thread. since multithreading is faster, firefox is faster(due to shared memory, context switching is faster in threads).
however, it is important to note that, chrome is less likely to crash since if one tab(process) crashes, it won’t crash the entire browser. opposite is true in case of firefox.