I am having some trouble understanding how to use Unix\'s fork()
. I am used to, when in need of parallelization, spawining threads in my application. It\'s always s
Fork()'s most popular use is as a way to clone a server for each new client that connect()s (because the new process inherits all file descriptors in whatever state they exist). But I've also used it to initiate a new (locally running) service on-demand from a client. That scheme is best done with two calls to fork() - one stays in the parent session until the server is up and running and able to connect, the other (I fork it off from the child) becomes the server and departs the parent's session so it can no longer be reached by (say) SIGQUIT.