2

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?

0

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().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.