In many programs and man pages of Linux, I have seen code using fork(). Why do we need to use fork() and what is its purpose?
c - What is the purpose of fork ()? - Stack Overflow
Fork handlers may be established by means of the pthread_atfork() function in order to maintain application invariants across fork() calls. When the application calls fork() from a signal handler and any of the fork handlers registered by pthread_atfork() calls a function that is not async-signal-safe, the behavior is undefined.
After few explorations, In my understanding, it is related to contribution. Fork means to make a copy of the repository (the one being forked) into my own github account. If I want to fork the off...
fork just creates a new process, and the simplest way of thinking that is to clone the current process. So the fork semantics is very natural, and it is the simplest machanism possible. Other system calls (execve) are in charge of loading a new executable, etc.. Separating them (and providing also pipe and dup2 syscalls) gives a lot of flexibility.
linux - Why fork () works the way it does - Stack Overflow
The use of fork and exec exemplifies the spirit of UNIX in that it provides a very simple way to start new tasks. Note the use of the word task here, I have deliberately avoided using the terms process or program, which you can define as: a process is an "engine of execution", something within the operating system which is capable of running a program; and a program is a specific piece of code ...