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

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question



























    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?










    share|improve this question

























      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?










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 18 at 13:23

























      asked Nov 18 at 6:56









      Nikhilesh Singh

      317




      317




















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






          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            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

























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






            share|improve this answer


























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






              share|improve this answer
























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






                share|improve this answer














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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 5 hours ago









                ctrl-alt-delor

                10k41955




                10k41955










                answered 13 hours ago









                Nikhilesh Singh

                317




                317



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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





















































                    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






                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)