The Linux kernel represents every process on the system using a process descriptor, defined as struct task_struct in include/linux/sched.h.
The process descriptor contains all the information required to execute the process, including functions such as scheduling, virtual address space management, and accounting.
A new process,or child, is created by copying an existing process, or parent, through the fork and clone system calls. clone is a Linux-specific system call that offers fine-grained control over which system resources the parent and child share through a set of clone flags passed as an argument, and is typically used for creating threads. fork, on the other hand, defines a static set of clone flags to create independent processes with the usual POSIX semantics.
These two system calls, in turn, invoke the function do_fork implemented inkernel/fork.
c, which allocates a new process descriptor for the child, initializes it, and prepares it for scheduling.
When the process is terminated, for example by invoking the exit system call, the function do_exit, implemented in kernel/exit.
c, deallocates resources associated with the process