Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. These browsers that have a separate process for each tab

These browsers that have a separate process for each tab

Scheduled Pinned Locked Moved The Lounge
javascriptquestion
33 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rob Philpott

    I understand that modern browsers like to spawn multiple processes behind the scene, usually on a per-tab basis perhaps. Anyone know how this works, as what you seem to end up with is several processes all accessing the same window? Windows is funny about multiple threads accessing the same window, never mind processes. Perhaps the rendering is done in the main process and all the comms/javascript/layout calculation etc. in the child ones. I don't know, but I'd like to. Anyone shed some light?

    Regards, Rob Philpott.

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #12

    A window is not always "one process". Hosting EXE Applications in a WinForm project[^]

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

    R 1 Reply Last reply
    0
    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

      It was a kind of joke, but I would risk here an answer now, even it is clearly a programming answer... In Windows, SetParent[^] can set the parent window even if it is from a different process... So technically it is an easy problem - all you need is to pass a HWND to the new (child) process and you are done... It is clear that in the case of Chrome the main process is different - in behaviour - from the others (even it is the same exe)... Hit Shift+Esc in Chrome and you will get a list o all the processes it is running... You can see that the one labeled 'Browser' can not be closed...This is the manager process... Now that you know all this, go and write a CP article about!!!

      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #13

      Kornfeld Eliyahu Peter wrote:

      SetParent[^] can set the parent window even if it is from a different process...

      Right, it's time for a career change! That seems to go completely against the whole point of a protected operating system. If I was drunk in the pub, a £50 bet would be looming. I will investigate this further. I think I found my answer here though: Chromium Blog: Multi-process Architecture[^] The browser process creates many renderer processes, each responsible for rendering web pages. The renderer processes contain all the complex logic for handling HTML, JavaScript, CSS, images, and so on. We achieve this using the open source WebKit rendering engine, which is also used by Apple's Safari web browser. Each renderer process is run in a sandbox, which means it has almost no direct access to your disk, network, or display. All interactions with web apps, including user input events and screen painting, must go through the browser process.

      Regards, Rob Philpott.

      1 Reply Last reply
      0
      • B Brady Kelly

        Whatever else, have you ever had a look how many Chrome processes are sometimes running, even with only 1 or 2 tabs open? :omg: I currently have 13 processes for 3 tabs.

        Follow my adventures with .NET Core at my new blog, Erisia Information Services.

        Kornfeld Eliyahu PeterK Offline
        Kornfeld Eliyahu PeterK Offline
        Kornfeld Eliyahu Peter
        wrote on last edited by
        #14

        Brady Kelly wrote:

        I currently have 13 processes for 3 tabs.

        3 tabs = 3 processes +1 for main windows +9 for extensions (each extension runs in a separated process)

        Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

        "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

        1 Reply Last reply
        0
        • L Lost User

          A window is not always "one process". Hosting EXE Applications in a WinForm project[^]

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          R Offline
          R Offline
          Rob Philpott
          wrote on last edited by
          #15

          Well, this is all news to me, this SetParent() spanning processes. I downloaded that project, and the browser opened in a separate window, not as a child of the winform. I am going to remain a skeptic until I see this properly.

          Regards, Rob Philpott.

          L 1 Reply Last reply
          0
          • R Rob Philpott

            Well, this is all news to me, this SetParent() spanning processes. I downloaded that project, and the browser opened in a separate window, not as a child of the winform. I am going to remain a skeptic until I see this properly.

            Regards, Rob Philpott.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #16

            Replace the exename from "iexplore" to the full path of calc.exe; once you have the handle you can set a new parent to the window. The new parent-window of the mainform does not have to be part of the application, it just needs to be an existing window handle.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            R 1 Reply Last reply
            0
            • L Lost User

              Replace the exename from "iexplore" to the full path of calc.exe; once you have the handle you can set a new parent to the window. The new parent-window of the mainform does not have to be part of the application, it just needs to be an existing window handle.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              R Offline
              R Offline
              Rob Philpott
              wrote on last edited by
              #17

              Genius Eddy! I am now going to work out how to utilize this madness! [edit: you're a y, not an ie, humble apologies]

              Regards, Rob Philpott.

              L 1 Reply Last reply
              0
              • R Rob Philpott

                Genius Eddy! I am now going to work out how to utilize this madness! [edit: you're a y, not an ie, humble apologies]

                Regards, Rob Philpott.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #18

                Rob Philpott wrote:

                Genius Eddy!

                Wasn't my idea to build Windows that way, but yes, great OS at some points. One way would be by wrapping functionality (and ui) inside a new standalone-application, and launch that instead of a thread. Makes debugging easier :) Or a way to hook some extra functionality inside an existing application.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                R 1 Reply Last reply
                0
                • R realJSOP

                  HOLY CRAP!

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  D Offline
                  D Offline
                  den2k88
                  wrote on last edited by
                  #19

                  I don't know if it's holy, but for sure it's /redacted/.

                  DURA LEX, SED LEX GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani

                  1 Reply Last reply
                  0
                  • L Lost User

                    Rob Philpott wrote:

                    Genius Eddy!

                    Wasn't my idea to build Windows that way, but yes, great OS at some points. One way would be by wrapping functionality (and ui) inside a new standalone-application, and launch that instead of a thread. Makes debugging easier :) Or a way to hook some extra functionality inside an existing application.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    R Offline
                    R Offline
                    Rob Philpott
                    wrote on last edited by
                    #20

                    Well what I wanted to do, is to try and get two independent GUI threads working in the same window hierarchy, something I always thought was impossible. This would open the possibility of a process with lots of GUI threads (possible certainly, but not in the same window hierarchy as far as I knew). This does that, and I've done it in a single process by spawning a second thread and making it execute the message pump of a second form. Completely independent yes, but when you 'join' them together with SetParent(), although we now have two separate GUI threads, they block each other. ie. I created a replacement for calc.exe which was a form with a button with a Sleep(10000) behind it. Demo project works fine, but when you hit the button, the 'host' process is blocked as well - you can't drag it around or anything. This makes sense I guess as one will send a MoveWindow message or something like that to the other, which is blocked, won't respond so blocks the other. A small glimmer of opportunity, but its seems its not to be...

                    Regards, Rob Philpott.

                    L 1 Reply Last reply
                    0
                    • D den2k88

                      AFAIK they all use different trheads - in fact if one tab crashes the whole browser is kaputt. Firefox qorks like that, IE is not a browser and Chrome kills my ram before starting up so I don't have too much experience on that one.

                      DURA LEX, SED LEX GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #21

                      ff only runs 1 process, even with many extensions & tabs and/or windows open. chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap?? Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).

                      Sin tack ear lol Pressing the "Any" key may be continuate

                      D K P D 4 Replies Last reply
                      0
                      • L Lost User

                        ff only runs 1 process, even with many extensions & tabs and/or windows open. chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap?? Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).

                        Sin tack ear lol Pressing the "Any" key may be continuate

                        D Offline
                        D Offline
                        den2k88
                        wrote on last edited by
                        #22

                        Lopatir wrote:

                        Even on my main box (16G DDR3 RAM) it's slower then ff

                        Holy mother... I guess Chrome will never see the light of my CPU then. Even on my next PC (16 GB DDR4, Intel i5 6600 if all goes well).

                        DURA LEX, SED LEX GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani

                        1 Reply Last reply
                        0
                        • M Marc Clifton

                          What freaks me out more is when you look at the command line for each tab in Chrome:

                          "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --type=renderer --enable-features="*AutofillCreditCardSigninPromo

                          G Offline
                          G Offline
                          Gary Wheeler
                          wrote on last edited by
                          #23

                          Judas H. Priest. :omg:

                          Software Zen: delete this;

                          1 Reply Last reply
                          0
                          • M Marc Clifton

                            What freaks me out more is when you look at the command line for each tab in Chrome:

                            "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --type=renderer --enable-features="*AutofillCreditCardSigninPromo

                            D Offline
                            D Offline
                            dandy72
                            wrote on last edited by
                            #24

                            "Command-line arguments are limited to 32,768 characters[*], and we're gonna use them all, dammit!!" -- Google, probably [*] Isn't that still the case? I haven't had a need to look in decades...

                            1 Reply Last reply
                            0
                            • R Rob Philpott

                              I understand that modern browsers like to spawn multiple processes behind the scene, usually on a per-tab basis perhaps. Anyone know how this works, as what you seem to end up with is several processes all accessing the same window? Windows is funny about multiple threads accessing the same window, never mind processes. Perhaps the rendering is done in the main process and all the comms/javascript/layout calculation etc. in the child ones. I don't know, but I'd like to. Anyone shed some light?

                              Regards, Rob Philpott.

                              N Offline
                              N Offline
                              Nish Nishant
                              wrote on last edited by
                              #25

                              There is one main process, and each tab gets its own process. Chromium IPC is used to chat with each other. See Inter-process Communication (IPC) - The Chromium Projects[^] A simple way to repro this is to have one process create a container window, and then have child processes create windows that are children of that container HWND. That said, Chrome does not really use HWNDs for its tabs, it uses WebKit. So the example I gave should not be taken literally :-)

                              Regards, Nish


                              Website: www.voidnish.com Blog: voidnish.wordpress.com

                              1 Reply Last reply
                              0
                              • L Lost User

                                ff only runs 1 process, even with many extensions & tabs and/or windows open. chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap?? Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).

                                Sin tack ear lol Pressing the "Any" key may be continuate

                                K Offline
                                K Offline
                                Kyle Moyer
                                wrote on last edited by
                                #26

                                Lopatir wrote:

                                who was the braniac that decided separate processes was a good idea???

                                Citibank's online chat support feature loads via AJAX calls made on the main thread, instead of in the background. In firefox (one process) this locks up your entire browser until the POS loads (which must be in a colo on the Moon, considering how long it takes...) In Chrome however, only the tab for Citibank locks up, so you can do something else while the page pulls its head out its... Their online chat support is also on a different server, and uses cross-site scripting (BLOCKED!) to pass account information (REALLY!?) So unless you allow XSS, the support monkeys can't see any of your account information, and can't help you. Bravo. Bravo. So, multiple processes helps to shield the user from terrible (or even malicious) website design. Ever see one of those pages that has an alert() loop? With multiple processes you can kill that one tab without losing whatever else you have open. Obviously there are other features and improvements that could be made to mitigate all of these problems in a single process browser... But the more commonly used ones don't seem to offer this out of the box.

                                1 Reply Last reply
                                0
                                • R Rob Philpott

                                  I understand that modern browsers like to spawn multiple processes behind the scene, usually on a per-tab basis perhaps. Anyone know how this works, as what you seem to end up with is several processes all accessing the same window? Windows is funny about multiple threads accessing the same window, never mind processes. Perhaps the rendering is done in the main process and all the comms/javascript/layout calculation etc. in the child ones. I don't know, but I'd like to. Anyone shed some light?

                                  Regards, Rob Philpott.

                                  K Offline
                                  K Offline
                                  Kirill Illenseer
                                  wrote on last edited by
                                  #27

                                  Typically, the browser frame is hosted in a process and every tab is hosted in a process. The main process (browser frame) is what you're interacting with and it delegates to the tab processes.

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    ff only runs 1 process, even with many extensions & tabs and/or windows open. chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap?? Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).

                                    Sin tack ear lol Pressing the "Any" key may be continuate

                                    P Offline
                                    P Offline
                                    piyush_singh
                                    wrote on last edited by
                                    #28

                                    Lopatir wrote:

                                    Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago

                                    That's true. Even I have started using Edge as my secondary browser, ff being default. Edge has its issues but it's definitely improving while Chrome just seems too slow. One thing though, I still prefer Chrome developer tool over ff for web development and Edge, I strictly use for browsing only. :)

                                    Piyush K Singh

                                    1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      What freaks me out more is when you look at the command line for each tab in Chrome:

                                      "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --type=renderer --enable-features="*AutofillCreditCardSigninPromo

                                      N Offline
                                      N Offline
                                      Nathan Minier
                                      wrote on last edited by
                                      #29

                                      If you ever wanted insight into the mind of a linux coder...

                                      "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

                                      1 Reply Last reply
                                      0
                                      • R Rob Philpott

                                        Well what I wanted to do, is to try and get two independent GUI threads working in the same window hierarchy, something I always thought was impossible. This would open the possibility of a process with lots of GUI threads (possible certainly, but not in the same window hierarchy as far as I knew). This does that, and I've done it in a single process by spawning a second thread and making it execute the message pump of a second form. Completely independent yes, but when you 'join' them together with SetParent(), although we now have two separate GUI threads, they block each other. ie. I created a replacement for calc.exe which was a form with a button with a Sleep(10000) behind it. Demo project works fine, but when you hit the button, the 'host' process is blocked as well - you can't drag it around or anything. This makes sense I guess as one will send a MoveWindow message or something like that to the other, which is blocked, won't respond so blocks the other. A small glimmer of opportunity, but its seems its not to be...

                                        Regards, Rob Philpott.

                                        L Offline
                                        L Offline
                                        Lost User
                                        wrote on last edited by
                                        #30

                                        Rob Philpott wrote:

                                        I created a replacement for calc.exe which was a form with a button with a Sleep(10000) behind it. Demo project works fine, but when you hit the button, the 'host' process is blocked as well - you can't drag it around or anything.

                                        * Gives a stern look * Well, your button code should not be blocking the UI-thread, as that is working the message-pump and minding it's own stuff. If you want to do something, do it from a new thread. As soon as you block the other window too long, the process wil be reported by windows as being "unresponsive".

                                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                        1 Reply Last reply
                                        0
                                        • L Lost User

                                          ff only runs 1 process, even with many extensions & tabs and/or windows open. chrome is just getting stupid (and fugly); sure bare bones is [supposedly] fastest, but just a few add-ons just starting up and rendering is way slower. (Of course you idiots, inter-process communications are slow - who was the braniac that decided separate processes was a good idea???) Without add-ons only has minimal standard settings (yep, jus like msof they think all users are stupid). Even on my main box (16G DDR3 RAM) it's slower then ff so I rarely use it and have already banished from the task bar it to the depths of the Accessories menu (it so does not deserve it's own menu). The mess of directories it creates are just way stupid too, caches mixed in with data files - how to set inclusive backups for that without backing up the crap?? Getting time to ditch chrome for edge as secondary browser, the edge is actually improving while chrome is for all it's updates is still stuck where it was 5 years ago (updates almost always security fixes - that really inspires confidence: NOT).

                                          Sin tack ear lol Pressing the "Any" key may be continuate

                                          D Offline
                                          D Offline
                                          Daniel Wilianto
                                          wrote on last edited by
                                          #31

                                          Seconded that. Yesterday I tried Edge since MS advertised that it supports ABP now, and it turned out to be a pleasant experience. I am using it now. Google chrome has transformed from from a lightweight browser into a big mess of tangled processes. It spawns almost ten processes which is named chrome, and two processes which is named crash handler, even though I only opened three tabs. You would think that they did this to handle crash better, but no, when one tab is not responding, the entirely of chrome stopped responding. Also it hogs CPU and RAM. I can't understand why such a huge company makes such an amateur mistake. Maybe they don't have capable programmers to begin with, instead they have people who are good at marketing and advertising. Oh yeah, let's not forget their faulty Google Drive for Desktop.

                                          L 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups