rAzOr
rAzOr

Reputation: 320

Priority inheritance from parent process by new process in linux

In Linux when a new process is created, it inherits the normal_prio value of it's parent process for it's static_prio. Where does this actually happen??

Is it done in dup_task_struct() function or in copy_process() function??

Upvotes: 1

Views: 786

Answers (1)

Pavan Manjunath
Pavan Manjunath

Reputation: 28535

It actually happens in sched_fork which is called by copy_process

The parent's priority is transferred into the child initially something like this

p->prio = current->normal_prio;

where p is child's task_struct and current points to parent.

And then normal_prio is modified like this

p->prio = p->normal_prio = __normal_prio(p);

__normal_prio(p) finally boils down to something like

return p->static_prio;

Check out the 2 links I've added to explore more.

Upvotes: 1

Related Questions