Task Relationships

In addition to the relationships resulting from ID links, the kernel is also responsible for managing the ''family relationships'' established on the basis of the Unix model of process creation. The following terminology is used in this context:

□ If process A forks to generate process B, A is known as the parent process and B as the child process.6

If process B forks again to create a further process C, the relationship between A and C is sometimes referred to as a grandparent and grandchild relationship.

□ If process A forks several times therefore generating several child processes Bj, B2,..., Bn, the relationship between the Bi processes is known as a siblings relationship.

Figure 2-6 illustrates the possible family relationships graphically.

The task_struct task data structure provides two list heads to help implement these relationships: <sched.h>

struct task_struct {

struct list_head children; /* list of my children */

6Unlike natural families, a process has only one parent.

struct list_head sibling; /* linkage in my parent's children list */

□ children is the list head for the list of all child elements of the process.

□ siblings is used to link siblings with each other.

Parent prcess

r

Children

Child prcess

—►

sibling

u

sibling

-

sibling

Figure 2-6: Family relationships between processes.

Figure 2-6: Family relationships between processes.

New children are placed at the start of the siblings list, meaning that the chronological sequence of forks can be reconstructed.7

Continue reading here: Process Management System Calls

Was this article helpful?

0 0