Kernelforkc

p->pid = pid_nr(pid); p->tgid = p->pid; if (clone_flags & CLONE_THREAD) p->tgid = current->tgid;

Recall that pid_nr computes the global numerical PID for a given pid instance.

For regular processes, the parent process is the forking process. This is different for threads: Since they are seen as the second (or third, or fourth,...) line of execution within the generating process, their parent is the parent's parent. This is easier to express in code than in words:

Continue reading here: Kernelforkc

Was this article helpful?

0 0