How does a new application run on a Mac?

I am looking for a process and a system call that is responsible for starting each new process on a Mac. I believe that this should be something like CreateProcess () and which returns the process ID of the newly created process. (This is an assumption)

I'm interested in the internal details, such as the thread responsible for launching a new application.

Any help is appreciated. Even some recommendations for caring for them can help.

0
source share
2 answers

Typically on Mac OS X, LaunchD is the parent of all processes. So LaunchD launches them. How?? First it is fork () , and then posix_spawn () .

0
source

OS X is a lot of Unix. New processes are created using the fork () system call . This creates an almost identical copy of the process that makes the call (the difference is that fork returns 0 in the child and pid of the child in the parent). Then it’s ok to use one of the exec () syscalls in the child to convert the child into a process executing another executable.

Edit

[ Cocoa], , Cocoa, NSTask, .

+1