Process Creation and MacOS

By: Louis Gerbarg (l.delete@this.g.com),
Room: Moderated Discussions
Gabriele Svelto (gabriele.svelto.delete@this.gmail.com) on November 30, 2020 1:05 pm wrote:
> Louis Gerbarg (l.delete@this.g.com) on November 29, 2020 5:23 pm wrote:
> > I actually agree with that, but I don't think that changes
> > my main point. For 25+ years Linux has been focused
> > on workloads like traditional project builds where the
> > speed of spawning small processes is significant, and
> > it does it very well. The fact that people are moving to
> > modern build systems that do not lean on that strength
> > does not change the fact that pressure from those traditional workloads pushed the Linux kernel to focus on
> > making process creation cheap, just like pressure from
> > running longer lived graphical processes pushed macOS
> > and Windows to develop sophisticated dynamic linking and loading
> > technologies in order to reduce memory footprint
> > and speed up app launch times that were dominated by linking (as opposed to process creation).
>
> I haven't seen numbers to back that up but even if it was true it doesn't explain why Linux is also
> faster at a number of common OS primitives such as filesystem access, IPC, threading, pipes, sockets,
> etc... And that's without mentioning scalability. I did my comparison with macOS using a limited number
> of cores that's around Apple's sweet spot but I'm pretty sure the comparison would become increasingly
> embarassing as the number of cores involved increases. All those primitives are not only faster on
> Linux but they scale a lot better, and that's especially true for filesystem access.

I completely believe that many primitives are faster on Linux. I was only stating that macOS (and likely Windows, though I have not looked into it) load and bind system libraries faster than Linux, and that just like how fast process creation biases how people architect their systems, so do cheap dynamic libraries.

For a concrete example, I ran sccache on macOS, stopped it before it after it had "mapped" in all of the system libraries it needs. There are 144 binaries loaded (the dynamic linker, the main executable, and 142 libraries larger consisting of the implementation of Libc, pthread, etc). Despite having so many loaded images, the dynamic linker made exactly 2 calls to mprotect() and 0 calls to mmap() before it started jumping into the loaded libraries to run their static initializers. They way we load system libraries is fast because it is architected substantially differently than Linux, and it causes us to build our system with A LOT more dynamic libraries. What you probably think of as critical path primitives for dynamic loading are barely even called.

I suspect if you were to do a similar experiment on Linux you would find it makes many more calls to mprotect() and mmap(), despite probably only have a handful of dynamic libraries loaded. That means the speed of those calls is probably very important in order to quickly launch processes. I also think despite those faster primitives, if glibc was fractured into 142 dynamic libraries it would take a lot more ram and substantially slow down your process initialization times. It would work, just pretty poorly, so you probably should not do that ;-)

Is my point that macOS is somehow really magically faster for your workload and your benchmarks are wrong? Absolutely not! My point is the systems are genuinely tuned for very different workloads, and that causes the critical paths for many common taks to be quite different. It also means when you move compatible code between the systems it may behave poorly because what you think of as being critical path primitive actually isn't on some other software stack. IOW, the software design is biased toward the system it is developed on, and when you run it on a different (put compatible) system with different optimization points it may perform poorly.
< Previous Post in ThreadNext Post in Thread >
Thread (392 posts)
TopicPosted ByPosted
The macOS performance deficitGabriele Svelto
  The macOS performance deficitrpg
    The macOS performance deficitChester
    It's not really a fair fightanon2
      It's not really a fair fightGabriele Svelto
        WSLanon
          WSLkonrad schwarz
            WSLMichael S
              WSLKonrad Schwarz
                WSLMichael S
                  Cygwin vs MSYSKonrad Schwarz
                    Cygwin vs MSYSMichael S
                      Cygwin vs MSYSKonrad Schwarz
                      Cygwin vs MSYSHoward Chu
          WSLWindowsExperience
            WSLHoward Chu
        WindowsChester
          WindowsMichael S
            WindowsHoward Chu
              WindowsChester
                WindowsMichael S
                  WindowsChester
                    WindowsMichael S
                      Windows and kernel timeChester
                        Windows and kernel timeEtienne Lorrain
                          Windows and kernel timeAndrey
                            Windows and kernel timeMichael S
                              Windows and kernel timeJames
                                Windows and kernel timeanon3
                                  Windows and kernel timeBrendan
                                    Windows and kernel timeanon3
                                      Windows and kernel timeBrendan
                                  Windows and kernel timeGionatan Danti
                              Windows and kernel timeAndrey
                                Windows and kernel timeSimon Farnsworth
                                  Windows and kernel timeanon
                                  You also avoid bus contentionCarson
                                    You also avoid bus contentionDavid Hess
                                      You also avoid bus contentionCarson
                                        You also avoid bus contentionDavid Hess
                                Windows and kernel timeKonrad Schwarz
                            Windows and kernel timeDavid Hess
                          Windows and kernel timeLinus Torvalds
                            Windows and kernel timeGionatan Danti
                              Windows and kernel timeLinus Torvalds
                                Windows and kernel timeBrendan
                                  Windows and kernel timeDoug S
                                    Windows and kernel timeBrendan
                                      I read the profile wrongChester
                                      Windows and kernel timeDoug S
                                Windows and kernel timeJörn Engel
                                  Windows and kernel timeLinus Torvalds
                                Thanks for the explanation (NT)Gionatan Danti
                            Windows and kernel timeGabriele Svelto
                            Windows and kernel timeEtienne Lorrain
                              Windows and kernel timeAdrian
        It's not really a fair fightHoward Chu
  The macOS performance deficitkonrad schwarz
    The macOS performance deficitJon Masters
      The macOS performance deficitsoftware_engineer
        The macOS performance deficitMaynard Handley
          The macOS performance deficitanon2
            The macOS performance deficitMaynard Handley
              The macOS performance deficitanon2
                The macOS performance deficitMaynard Handley
                  The macOS performance deficitanon2
            The macOS performance deficitGabriele Svelto
              The macOS performance deficitUngo
                The macOS performance deficitGabriele Svelto
                The macOS performance deficitanon2
                  The macOS performance deficitUngo
                    The macOS performance deficitanon2
                      The macOS performance deficitUngo
                        The macOS performance deficitanon2
      The macOS performance deficitLinus Torvalds
        The macOS performance deficitgallier2
          The macOS performance deficitLinus Torvalds
        The macOS performance deficitJon Masters
        Microsoft LinuxPaul
          Microsoft LinuxMichael S
          Microsoft Linuxm
          Microsoft LinuxDummond D. Slow
          Microsoft LinuxRobert Williams
            Microsoft Linuxm
              Microsoft LinuxMichael S
                Microsoft Linuxm
          Microsoft Linuxjuanrga
            Microsoft Linuxm
              Microsoft Linuxgpd
      The macOS performance deficitGabriele Svelto
        The macOS performance deficitRicardo B
          The macOS performance deficitGionatan Danti
            The macOS performance deficitRicardo B
              The macOS performance deficitJacob Marley
                The macOS performance deficitRicardo B
                  The macOS performance deficitGionatan Danti
            The macOS performance deficitEtienne Lorrain
              The macOS performance deficitGionatan Danti
  The macOS performance deficitI_vs
    The macOS performance deficitGabriele Svelto
      The macOS performance deficitI_vs
        What is the disk performance of each system? (NT)Anon
          What is the disk performance of each system?I_vs
        The macOS performance deficitDummond D. Slow
          The macOS performance deficitI_vs
            The macOS performance deficitJukka Larja
            The macOS performance deficitHoward Chu
              The macOS performance deficitI_vs
            The macOS performance deficitAdrian
          The macOS performance deficitMichael S
        The macOS performance deficitGabriele Svelto
  The macOS performance deficitDoug S
    The macOS performance deficitLinus Torvalds
      The macOS performance deficitm
        Process Creation and MacOSRob Thorpe
          Process Creation and MacOSNksingh
            Process Creation and MacOSFoo_
              Process Creation and MacOSnksingh
            Interesting, looks like I was wrong on Windows tooRob Thorpe
              I meant to put (NT) in that title. And this one. (NT)Rob Thorpe
          Process Creation and MacOSLouis Gerbarg
            Process Creation and MacOSGabriele Svelto
              Process Creation and MacOSLouis Gerbarg
                Process Creation and MacOSGabriele Svelto
                  Process Creation and MacOSLouis Gerbarg
                  Process Creation and MacOSgallier2
                    Process Creation and MacOSGabriele Svelto
                    Process Creation and MacOSFoo_
            That's informative (NT).Rob Thorpe
          Process Creation and MacOSnoko
    The macOS performance deficitGabriele Svelto
      The macOS performance deficitanon2
      The macOS performance deficitI_vs
        The macOS performance deficitMaynard Handley
          The macOS performance deficitanon2
            The macOS performance deficitMaynard Handley
              The macOS performance deficitanon2
                The macOS performance deficitMaynard Handley
                  The macOS performance deficitanon2
                    The macOS performance deficitBrett
                      The macOS performance deficitanon2
                  The macOS performance deficitJörn Engel
              The macOS performance deficitGionatan Danti
          The macOS performance deficitI_vs
            The macOS performance deficitanon2
    The macOS performance deficitAndrey
  The macOS performance deficitBrett
    The macOS performance deficitMaynard Handley
    Sour grapes (NT)anon2
    The macOS performance deficitGabriele Svelto
    The macOS performance deficitAndrey
      The macOS performance deficitBrett
        The macOS performance deficitAndrey
          The macOS performance deficitMaynard Handley
            The macOS performance deficitAndrey
              The macOS performance deficitrwessel
              The macOS performance deficitJames
            The macOS performance deficitGabriele Svelto
          The macOS performance deficitBrett
            The macOS performance deficitDummond D. Slow
              The macOS performance deficitBrett
                The macOS performance deficitMaynard Handley
                  The macOS performance deficitJukka Larja
                    The macOS performance deficitMaynard Handley
                      The macOS performance deficitDummond D. Slow
                      The macOS performance deficitsoftware_engineer
                        The macOS performance deficitMaynard Handley
                          The macOS performance deficitJukka Larja
                            The macOS performance deficitMaynard Handley
                              The macOS performance deficitJukka Larja
                          The macOS performance deficitsoftware_engineer
                            The macOS performance deficitMaynard Handley
                      The macOS performance deficitJukka Larja
                      The macOS performance deficitJames
                        The macOS performance deficitFoo_
                          The macOS performance deficitFoo_
                            The macOS performance deficitMaynard Handley
            The macOS performance deficitanon2
              The macOS performance deficitBrett
                The macOS performance deficitanon2
            The macOS performance deficitAndrey
              The macOS performance deficitBrett
                The macOS performance deficitLinus Torvalds
                  The macOS performance deficitBrett
                    The macOS performance deficitanon2
                      The macOS performance deficitBrett
                        The macOS performance deficitGabriele Svelto
                          The macOS performance deficitBrett
                            The macOS performance deficitMaynard Handley
                              The macOS performance deficitanon3
                              The macOS performance deficitGionatan Danti
                                The macOS performance deficitDummond D. Slow
                                  The macOS performance deficitMaynard Handley
                                    The macOS performance deficitGionatan Danti
                                      The macOS performance deficitMaynard Handley
                                        The macOS performance deficitBrett
                                        The macOS performance deficitGionatan Danti
                                          The macOS performance deficitMaynard Handley
                                            The macOS performance deficitGionatan Danti
                                          The macOS performance deficitUngo
                                            The macOS performance deficitGionatan Danti
                                              The macOS performance deficitDoug S
                                                The macOS performance deficitGionatan Danti
                                                  The macOS performance deficitDoug S
                                                    The macOS performance deficitGionatan Danti
                                                      The macOS performance deficitDoug S
                                                        The macOS performance deficitDummond D. Slow
                                                          The macOS performance deficitEtienne Lorrain
                                                        The macOS performance deficitGionatan Danti
                                                    The macOS performance deficitDummond D. Slow
                                                    SDRGJHI4 ?Michael S
                                                      SDRGJHI4 ?Doug S
                                                      SDRGJHI4 ?Ungo
                                              The macOS performance deficitUngo
                                                The macOS performance deficitRicardo B
                                          The macOS performance deficitMichael S
                                            4xMichael S
                                              4xDoug S
                                              4xRicardo B
                                                4xAnon
                                                  4xAnon
                                                  4xAndrey
                                                  4xRicardo B
                                                    4xAnon
                                                      4xRicardo B
                                                        4xAnon
                                                          4xRicardo B
                                                            4xAnon
                                              python v C/C++Michael S
                                                hw mattersMichael S
                                                  hw mattersFoo_
                                                    hw mattersMichael S
                                                      SSD history mattersAdrian
                                                  hw mattersRicardo B
                                                    hw mattersMichael S
                                                      hw mattersRicardo B
                                                  hw mattersGionatan Danti
                                                    hw mattersMichael S
                                                      hw mattersGionatan Danti
                                                        hw mattersMichael S
                                                          hw mattersGionatan Danti
                                                            hw mattersMichael S
                                                              Win7 Home vs ProMichael S
                                                                Win7 Home vs ProGionatan Danti
                                                for MSVC usersMichael S
                                            The macOS performance deficitGionatan Danti
                                              The macOS performance deficitJukka Larja
                                                The macOS performance deficitRicardo B
                                                  The macOS performance deficitJukka Larja
                                                    The macOS performance deficitGionatan Danti
                                                      The macOS performance deficitJukka Larja
                                                        The macOS performance deficitGionatan Danti
                                                      The macOS performance deficitUngo
                                                        The macOS performance deficitJukka Larja
                                                          The macOS performance deficitMichael S
                                                            The macOS performance deficitGionatan Danti
                                                              The macOS performance deficitMichael S
                                                                The macOS performance deficitGionatan Danti
                                                                  The macOS performance deficitMichael S
                                                        The macOS performance deficitGionatan Danti
                                                          The macOS performance deficitMichael S
                                                          The macOS performance deficitUngo
                                                            The macOS performance deficitanon3
                                                              The macOS performance deficitGionatan Danti
                                                            The macOS performance deficitGionatan Danti
                                                              The macOS performance deficitUngo
                                                                The macOS performance deficitLinus Torvalds
                                                                  The macOS performance deficitUngo
                                                                  The macOS performance deficitGionatan Danti
                                                                    The macOS performance deficitLinus Torvalds
                                                                      The macOS performance deficitGionatan Danti
                                                                        The macOS performance deficitLinus Torvalds
                                                                          Linux writebackGionatan Danti
                                                                            Linux writebackLinus Torvalds
                                                                              Good points, thanks (NT)Gionatan Danti
                                                                The macOS performance deficitRicardo B
                                                            The macOS performance deficitRicardo B
                                                              The macOS performance deficitRicardo B
                                                              The macOS performance deficitLinus Torvalds
                                                                The macOS performance deficitRicardo B
                                                                  Ext4 performance deficitBrett
                                                                    Ext4 performance deficitRicardo B
                                                                      Ext4 performance deficitBrett
                                                                        Ext4 performance deficitBrett
                                                                        Ext4 performance deficitGionatan Danti
                                                                          Ext4 performance deficitBrett
                                                                            Ext4 performance deficitanonymou5
                                                                            Ext4 performance deficitGionatan Danti
                                                                              Ext4 performance deficitBrett
                                                                                Ext4 performance deficitGionatan Danti
                                                                                  Ext4 performance deficitBrett
                                                                                    Ext4 performance deficitanon2
                                                                                  Ext4 performance deficitUngo
                                                                                    Ext4 performance deficitBrett
                                                                                      Ext4 performance deficitanonymou5
                                                                                        Ext4 performance deficitBrett
                                                                                          Ext4 performance deficitMichael S
                                                                                          Ext4 performance deficitanonymou5
                                                                                          Ext4 performance deficitLinus Torvalds
                                                                                            Ext4 performance deficitMichael S
                                                                                              Ext4 performance deficitBrett
                                                                                            Ext4 performance deficitanon
                                                                                            Ext4 performance deficitFoo_
                                                                                              Ext4 performance deficitrwessel
                                                                                            Ext4 performance deficitBrett
                                                                                              Ext4 performance deficitBrett
                                                                                                Ext4 performance deficitanon
                                                                                                  Ext4 performance deficitBrett
                                                                                                    Ext4 performance deficitMichael S
                                                                                                      Ext4 performance deficitLinus Torvalds
                                                                                                      Ext4 performance deficitBrett
                                                                                                        Ext4 performance deficitMichael S
                                                                                      Ext4 performance deficitAdrian
                                                                                        Ext4 performance deficitanon
                                                                                          Ext4 performance deficitAdrian
                                                                                    Ext4 performance deficitGionatan Danti
                                                                            Ext4 performance deficitJörn Engel
                                                                    Serving NTFS?Michael S
                                                            The macOS performance deficitgallier2
                                    The macOS performance deficitAndrey
                                      The macOS performance deficitUngo
                                        The macOS performance deficitMaynard Handley
                                          The macOS performance deficitUngo
                                            The macOS performance deficitMaynard Handley
                                        The macOS performance deficitAndrey
                                          The macOS performance deficitGionatan Danti
                                          The macOS performance deficitAnne O. Nymous
                                        The macOS performance deficitRicardo B
                                          The macOS performance deficitUngo
                                            The macOS performance deficitRicardo B
                                            The macOS performance deficitDoug S
                                              The macOS performance deficitMatt Sayler
                                              The macOS performance deficitGionatan Danti
                                              The macOS performance deficitLouis Gerbarg
                                                The macOS performance deficitDoug S
                                      The macOS performance deficitMaynard Handley
                                        The macOS performance deficitAndrey
                                          I take it no one here has any real storage admin experienceDoug S
                                            I take it no one here has any real storage admin experienceGionatan Danti
                                            I take it no one here has any real storage admin experienceAndrey
                                            I take it no one here has any real storage admin experienceDavid Hess
                                              I take it no one here has any real storage admin experienceDoug S
                                                I take it no one here has any real storage admin experienceDavid Hess
                                        The macOS performance deficitSimon Farnsworth
                                        The macOS performance deficitRicardo B
                        The macOS performance deficitanon2
                  The macOS performance deficitDoug S
                    The macOS performance deficitLinus Torvalds
                      The macOS performance deficitHoward Chu
                        The macOS performance deficitLinus Torvalds
                          The macOS performance deficitrwessel
                          The macOS performance deficitanon
                          The macOS performance deficitHoward Chu
                            The macOS performance deficitLinus Torvalds
                              The macOS performance deficitBrett
                                The macOS performance deficitBrett
                                  The macOS performance deficitLinus Torvalds
                                    The macOS performance deficitPatrick Schlüter aka gallier2
                                    The macOS performance deficitDoug S
                                      The macOS performance deficitAdrian
                                        The macOS performance deficitLinus Torvalds
                                          The macOS performance deficitAdrian
                                    The macOS performance deficitBrett
                                The macOS performance deficitDavid Hess
                              BitKeeperanon
                                BitKeeperanon
                                charlatansanon2
                                  charlatansMichael S
                                    charlatansanon2
                                      charlatansrwessel
                                      version controlMichael S
                                        version controlLinus Torvalds
                                          Cheap commits are a huge git winCarson
                                        version controlanon2
                                BitKeeperLinus Torvalds
                                  BitKeeperanon
                                    BitKeeperanonymou5
                                    Larry? (NT)anon2
                                      Larry McVoy, the lead developer of bitkeeper (NT)Carson
                              The macOS performance deficitDoug S
                            The macOS performance deficitrwessel
                              The macOS performance deficitanon
                        LMDB transactionsanon
                          LMDB transactionsHoward Chu
                            LMDB transactionsanon
                              LMDB transactionsHoward Chu
                                LMDB transactionsanon
                                  LMDB transactionsHoward Chu
                                    LMDB transactionsHoward Chu
                                      LMDB transactionsAnon
                        Fossil SCM (SQLite based) works pretty well (NT)anonymous2
                      The macOS performance deficitAnon