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 Offline
    R Offline
    Rob Philpott
    wrote on last edited by
    #1

    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.

    D F Kornfeld Eliyahu PeterK M B 8 Replies 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.

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

      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 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.

        F Offline
        F Offline
        F ES Sitecore
        wrote on last edited by
        #3

        They're not accessing the same window, each tab will be its own GUI window that the process for that tab will interact with, with the title-bar, tab selectors etc belonging to the parent app, but the area inside the tab will belong to the child process. Think of browser tabs like a Multi Document Interface where each document is always maximised to the size of the parent browser process.

        R 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.

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

          GitHub - chromium/chromium: Open-source project behind Google Chrome[^]

          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

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

            GitHub - chromium/chromium: Open-source project behind Google Chrome[^]

            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
            #5

            Thanks for the link, but I'm not sufficiently interested to go through that!

            Regards, Rob Philpott.

            Kornfeld Eliyahu PeterK 1 Reply Last reply
            0
            • F F ES Sitecore

              They're not accessing the same window, each tab will be its own GUI window that the process for that tab will interact with, with the title-bar, tab selectors etc belonging to the parent app, but the area inside the tab will belong to the child process. Think of browser tabs like a Multi Document Interface where each document is always maximised to the size of the parent browser process.

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

              Well this goes against my understanding. You have a main browser window which as you say has title bars and all that stuff, a child control/window (tab selector), and each tab will be its own window as well (probably chrome then another child for its client area). How on earth do you get another process to provide the rendering/message pump etc. to that?

              Regards, Rob Philpott.

              1 Reply Last reply
              0
              • R Rob Philpott

                Thanks for the link, but I'm not sufficiently interested to go through that!

                Regards, Rob Philpott.

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

                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.

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

                R 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.

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #8

                  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

                  R F G D N 5 Replies 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

                    R Offline
                    R Offline
                    realJSOP
                    wrote on last edited by
                    #9

                    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 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

                      F Offline
                      F Offline
                      Foothill
                      wrote on last edited by
                      #10

                      They still use command line arguments!? That's so 1970's! I thought Google would be more modern than that. :-\

                      if (Object.DividedByZero == true) { Universe.Implode(); } Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

                      D 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.

                        B Offline
                        B Offline
                        Brady Kelly
                        wrote on last edited by
                        #11

                        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 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.

                          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
                                          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