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.
Fork creates a duplicate process and a new process context. When it returns a 0 value it means that a child process is running, but when it returns another value that means a parent process is running.
A fork is a copy of a project folder (repository) into your github account or onto your desktop if you use Github on your Desktop. This allows you to freely experiment with changes without affecting the original project.
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 ...
Fork is a system call and you shouldnt think of it as a normal C function. When a fork () occurs you effectively create two new processes with their own address space.Variable that are initialized before the fork () call store the same values in both the address space.
This topic gives a good description of fork, vfork, clone and exec. Below are some often overlooked differences between fork and vfork I experienced on some Linux 2.6.3x embedded systems I worked with. Even with copy-on-write techniques, fork fails if you don't have enough memory to duplicate the memory used by the parent process.
If I fork a project that's hosted on github. Do I fork all the branches? How do I know which branch my fork is based on? In other words which branch will be downloaded to my PC?
The C standard library (glibc) implements fork() which calls a UNIX/Linux-specific system call eventually to create a process, on Windows, you should use the winapi CreateProcess() see this example in MSDN. Note: Cygwin fork() is just a wrapper around CreateProcess() see How is fork () implemented?