Process synchronization in Linux involves providing a time slice for each process so that they get the required time for execution.
The process can be created using the fork() command in Linux. The creating process is called the parent process and the created process is the child process. A child process can have only one parent but a parent process may have many children. Both the parent and child processes have the same memory image, open files and environment strings. However, they have distinct address spaces.
A diagram that demonstrates the fork() command is given as follows −
There are some processes that are still running even though their parent process has terminated or finished. These are known as orphan processes.Processes can be orphaned intentionally or unintentionally. An intentionally orphaned process runs in the background without any manual support. This is usually done to start an indefinitely running service or to complete a long-running job without user attention.
An unintentionally orphaned process is created when its parent process crashes or terminates. Unintentional orphan processes can be avoided using the process group mechanism.
Some processes run in the background and are not in the direct control of the user. These are known as daemon processes. These processes are usually started when the system is bootstrapped and they terminate when the system is shut down.
Usually the daemon processes have a parent process that is the init process. This is because the init process usually adopts the daemon process after the parent process forks the daemon process and terminates.