When we create a new a process, where in the linux kernel is its priority assigned?

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I am starting to work on linux kernels. I am using Linux 4.19.2
https://elixir.bootlin.com/linux/v4.19.2/ident/
I figured out the structure called task_struct which contains all the information in the Process Control Block. When we create a new process, the fork() function is called, which in turn, calls functions like _do_fork() and copy_process() to provide values for the fields in task_struct.
However, I couldn't find out where is the priority of a new process. The field name used for priority in the task_struct structure is prio. Where does it get its value from, when a process is started? Am I going wrong somewhere?
linux-kernel
add a comment |
up vote
2
down vote
favorite
I am starting to work on linux kernels. I am using Linux 4.19.2
https://elixir.bootlin.com/linux/v4.19.2/ident/
I figured out the structure called task_struct which contains all the information in the Process Control Block. When we create a new process, the fork() function is called, which in turn, calls functions like _do_fork() and copy_process() to provide values for the fields in task_struct.
However, I couldn't find out where is the priority of a new process. The field name used for priority in the task_struct structure is prio. Where does it get its value from, when a process is started? Am I going wrong somewhere?
linux-kernel
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am starting to work on linux kernels. I am using Linux 4.19.2
https://elixir.bootlin.com/linux/v4.19.2/ident/
I figured out the structure called task_struct which contains all the information in the Process Control Block. When we create a new process, the fork() function is called, which in turn, calls functions like _do_fork() and copy_process() to provide values for the fields in task_struct.
However, I couldn't find out where is the priority of a new process. The field name used for priority in the task_struct structure is prio. Where does it get its value from, when a process is started? Am I going wrong somewhere?
linux-kernel
I am starting to work on linux kernels. I am using Linux 4.19.2
https://elixir.bootlin.com/linux/v4.19.2/ident/
I figured out the structure called task_struct which contains all the information in the Process Control Block. When we create a new process, the fork() function is called, which in turn, calls functions like _do_fork() and copy_process() to provide values for the fields in task_struct.
However, I couldn't find out where is the priority of a new process. The field name used for priority in the task_struct structure is prio. Where does it get its value from, when a process is started? Am I going wrong somewhere?
linux-kernel
linux-kernel
edited Nov 18 at 13:23
asked Nov 18 at 6:56
Nikhilesh Singh
317
317
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I tried figuring it out from this link https://elixir.bootlin.com/linux/v4.19.2/ident/
This provides a Linux kernels cross-referenced, that I can read. I figured out that to fork a new process, the function _do_fork() calls copy_process() which in turn calls a function called sched_fork().
This is where the priority of the process is initialised using the function normal_prio().
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I tried figuring it out from this link https://elixir.bootlin.com/linux/v4.19.2/ident/
This provides a Linux kernels cross-referenced, that I can read. I figured out that to fork a new process, the function _do_fork() calls copy_process() which in turn calls a function called sched_fork().
This is where the priority of the process is initialised using the function normal_prio().
add a comment |
up vote
0
down vote
I tried figuring it out from this link https://elixir.bootlin.com/linux/v4.19.2/ident/
This provides a Linux kernels cross-referenced, that I can read. I figured out that to fork a new process, the function _do_fork() calls copy_process() which in turn calls a function called sched_fork().
This is where the priority of the process is initialised using the function normal_prio().
add a comment |
up vote
0
down vote
up vote
0
down vote
I tried figuring it out from this link https://elixir.bootlin.com/linux/v4.19.2/ident/
This provides a Linux kernels cross-referenced, that I can read. I figured out that to fork a new process, the function _do_fork() calls copy_process() which in turn calls a function called sched_fork().
This is where the priority of the process is initialised using the function normal_prio().
I tried figuring it out from this link https://elixir.bootlin.com/linux/v4.19.2/ident/
This provides a Linux kernels cross-referenced, that I can read. I figured out that to fork a new process, the function _do_fork() calls copy_process() which in turn calls a function called sched_fork().
This is where the priority of the process is initialised using the function normal_prio().
edited 5 hours ago
ctrl-alt-delor
10k41955
10k41955
answered 13 hours ago
Nikhilesh Singh
317
317
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482479%2fwhen-we-create-a-new-a-process-where-in-the-linux-kernel-is-its-priority-assign%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown