How does the kernel assign the nice value to a process after it has been executed? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsHow is nice working?Why can't I use renice to increase a process' nice value?Real time processes scheduling in LinuxDoes the timeslice depend on process priority or not under Completely Fair Scheduling?How can I verify `nice` is working?Why is nice-level ignored? (Between different login sessions — honoured if started from same session.)Nice does not affect utilization?Custom priority value: is a pthread high sched prio positive or negative?Among these two in my ps output, which real-time process will be preempted over the other by linux?The `PRI` column of `ps` is inconsistent with man pages

How to read αἱμύλιος or when to aspirate

How to support a colleague who finds meetings extremely tiring?

should truth entail possible truth

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Would an alien lifeform be able to achieve space travel if lacking in vision?

What is the padding with red substance inside of steak packaging?

different output for groups and groups USERNAME after adding a username to a group

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

Is there a writing software that you can sort scenes like slides in PowerPoint?

What was the last x86 CPU that did not have the x87 floating-point unit built in?

Mortgage adviser recommends a longer term than necessary combined with overpayments

US Healthcare consultation for visitors

Using dividends to reduce short term capital gains?

Button changing its text & action. Good or terrible?

Why did Peik Lin say, "I'm not an animal"?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

How to type a long/em dash `—`

What's the point in a preamp?

Can I visit the Trinity College (Cambridge) library and see some of their rare books

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Does Parliament need to approve the new Brexit delay to 31 October 2019?

How to handle characters who are more educated than the author?

Do ℕ, mathbbN, BbbN, symbbN effectively differ, and is there a "canonical" specification of the naturals?

how can a perfect fourth interval be considered either consonant or dissonant?



How does the kernel assign the nice value to a process after it has been executed?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election ResultsHow is nice working?Why can't I use renice to increase a process' nice value?Real time processes scheduling in LinuxDoes the timeslice depend on process priority or not under Completely Fair Scheduling?How can I verify `nice` is working?Why is nice-level ignored? (Between different login sessions — honoured if started from same session.)Nice does not affect utilization?Custom priority value: is a pthread high sched prio positive or negative?Among these two in my ps output, which real-time process will be preempted over the other by linux?The `PRI` column of `ps` is inconsistent with man pages



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















The Linux kernel implements two separate priority ranges. The first is the nice value, a number from –20 to +19 with a default of 0.



Nice values are the standard priority range used in all Unix systems, although different Unix systems apply them in different ways.



What I want to know is with which parameters is calculated the nice value to be assigned after the process.



Thanks for your time.










share|improve this question







New contributor




Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    2















    The Linux kernel implements two separate priority ranges. The first is the nice value, a number from –20 to +19 with a default of 0.



    Nice values are the standard priority range used in all Unix systems, although different Unix systems apply them in different ways.



    What I want to know is with which parameters is calculated the nice value to be assigned after the process.



    Thanks for your time.










    share|improve this question







    New contributor




    Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      The Linux kernel implements two separate priority ranges. The first is the nice value, a number from –20 to +19 with a default of 0.



      Nice values are the standard priority range used in all Unix systems, although different Unix systems apply them in different ways.



      What I want to know is with which parameters is calculated the nice value to be assigned after the process.



      Thanks for your time.










      share|improve this question







      New contributor




      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      The Linux kernel implements two separate priority ranges. The first is the nice value, a number from –20 to +19 with a default of 0.



      Nice values are the standard priority range used in all Unix systems, although different Unix systems apply them in different ways.



      What I want to know is with which parameters is calculated the nice value to be assigned after the process.



      Thanks for your time.







      process cpu scheduling nice priority






      share|improve this question







      New contributor




      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      Luigi CapogrossoLuigi Capogrosso

      112




      112




      New contributor




      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Luigi Capogrosso is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          0














          There is no a silver formula which tells you exactly the numbers behind. It all depends on particular implementation on kernel scheduler side.



          If you're interested in details, you can check priority logic of default Linux kernel scheduler (Completely Fair Scheduler) e.g. here.



          Copy-paste-for-the-future-visitors (in case the link will expire after a few years):




          Priorities



          Every process has two priorities associated with it. One is called as
          nice value of process. It ranges from -20 to 19, default being 0.
          Lower the nice value, higher the priority. If there are two processes
          having nice value as 5 (process 1)and 10 (process 2), process 1 has
          high priority.



          We can check nice values of process’s nice values using ps -el command
          on shell. In Kernel space it is translated as MAX_RT_PRIORITY + 20 +
          nice value. It is stored in static_prio field of the task_struct.



          Second priority is real-time priority. These have opposite notion,
          means higher the value, higher the priority of the process. It ranges
          from 0 to 100.



          There is one more field which is present in task_struct called as
          prio, which in turn stores the effective priority of process which is
          being considered by scheduler to boost or thwart priority in order to
          avoid cases like priority inversion.



          In earlier schedulers priority values were used in decided the next
          process and the time slice it gets on the processor. There were many
          short-comings in that approach , very well described in book “Linux
          Kernel Development” by Robet Love.



          In CFS, instead of using priorities to decide absolute time a process
          gets on processor, portion of processor time a process ought to get on
          processor was calculated, based on the overall load of the system. If
          a process is getting less than what it should get, it will eventually
          move towards the left side of RB tree and get the processor time.







          share|improve this answer


















          • 1





            Do you have a license to copy-paste that content?

            – Stephen Kitt
            yesterday











          • Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

            – Luigi Capogrosso
            yesterday











          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',
          autoActivateHeartbeat: false,
          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
          );



          );






          Luigi Capogrosso is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511921%2fhow-does-the-kernel-assign-the-nice-value-to-a-process-after-it-has-been-execute%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









          0














          There is no a silver formula which tells you exactly the numbers behind. It all depends on particular implementation on kernel scheduler side.



          If you're interested in details, you can check priority logic of default Linux kernel scheduler (Completely Fair Scheduler) e.g. here.



          Copy-paste-for-the-future-visitors (in case the link will expire after a few years):




          Priorities



          Every process has two priorities associated with it. One is called as
          nice value of process. It ranges from -20 to 19, default being 0.
          Lower the nice value, higher the priority. If there are two processes
          having nice value as 5 (process 1)and 10 (process 2), process 1 has
          high priority.



          We can check nice values of process’s nice values using ps -el command
          on shell. In Kernel space it is translated as MAX_RT_PRIORITY + 20 +
          nice value. It is stored in static_prio field of the task_struct.



          Second priority is real-time priority. These have opposite notion,
          means higher the value, higher the priority of the process. It ranges
          from 0 to 100.



          There is one more field which is present in task_struct called as
          prio, which in turn stores the effective priority of process which is
          being considered by scheduler to boost or thwart priority in order to
          avoid cases like priority inversion.



          In earlier schedulers priority values were used in decided the next
          process and the time slice it gets on the processor. There were many
          short-comings in that approach , very well described in book “Linux
          Kernel Development” by Robet Love.



          In CFS, instead of using priorities to decide absolute time a process
          gets on processor, portion of processor time a process ought to get on
          processor was calculated, based on the overall load of the system. If
          a process is getting less than what it should get, it will eventually
          move towards the left side of RB tree and get the processor time.







          share|improve this answer


















          • 1





            Do you have a license to copy-paste that content?

            – Stephen Kitt
            yesterday











          • Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

            – Luigi Capogrosso
            yesterday















          0














          There is no a silver formula which tells you exactly the numbers behind. It all depends on particular implementation on kernel scheduler side.



          If you're interested in details, you can check priority logic of default Linux kernel scheduler (Completely Fair Scheduler) e.g. here.



          Copy-paste-for-the-future-visitors (in case the link will expire after a few years):




          Priorities



          Every process has two priorities associated with it. One is called as
          nice value of process. It ranges from -20 to 19, default being 0.
          Lower the nice value, higher the priority. If there are two processes
          having nice value as 5 (process 1)and 10 (process 2), process 1 has
          high priority.



          We can check nice values of process’s nice values using ps -el command
          on shell. In Kernel space it is translated as MAX_RT_PRIORITY + 20 +
          nice value. It is stored in static_prio field of the task_struct.



          Second priority is real-time priority. These have opposite notion,
          means higher the value, higher the priority of the process. It ranges
          from 0 to 100.



          There is one more field which is present in task_struct called as
          prio, which in turn stores the effective priority of process which is
          being considered by scheduler to boost or thwart priority in order to
          avoid cases like priority inversion.



          In earlier schedulers priority values were used in decided the next
          process and the time slice it gets on the processor. There were many
          short-comings in that approach , very well described in book “Linux
          Kernel Development” by Robet Love.



          In CFS, instead of using priorities to decide absolute time a process
          gets on processor, portion of processor time a process ought to get on
          processor was calculated, based on the overall load of the system. If
          a process is getting less than what it should get, it will eventually
          move towards the left side of RB tree and get the processor time.







          share|improve this answer


















          • 1





            Do you have a license to copy-paste that content?

            – Stephen Kitt
            yesterday











          • Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

            – Luigi Capogrosso
            yesterday













          0












          0








          0







          There is no a silver formula which tells you exactly the numbers behind. It all depends on particular implementation on kernel scheduler side.



          If you're interested in details, you can check priority logic of default Linux kernel scheduler (Completely Fair Scheduler) e.g. here.



          Copy-paste-for-the-future-visitors (in case the link will expire after a few years):




          Priorities



          Every process has two priorities associated with it. One is called as
          nice value of process. It ranges from -20 to 19, default being 0.
          Lower the nice value, higher the priority. If there are two processes
          having nice value as 5 (process 1)and 10 (process 2), process 1 has
          high priority.



          We can check nice values of process’s nice values using ps -el command
          on shell. In Kernel space it is translated as MAX_RT_PRIORITY + 20 +
          nice value. It is stored in static_prio field of the task_struct.



          Second priority is real-time priority. These have opposite notion,
          means higher the value, higher the priority of the process. It ranges
          from 0 to 100.



          There is one more field which is present in task_struct called as
          prio, which in turn stores the effective priority of process which is
          being considered by scheduler to boost or thwart priority in order to
          avoid cases like priority inversion.



          In earlier schedulers priority values were used in decided the next
          process and the time slice it gets on the processor. There were many
          short-comings in that approach , very well described in book “Linux
          Kernel Development” by Robet Love.



          In CFS, instead of using priorities to decide absolute time a process
          gets on processor, portion of processor time a process ought to get on
          processor was calculated, based on the overall load of the system. If
          a process is getting less than what it should get, it will eventually
          move towards the left side of RB tree and get the processor time.







          share|improve this answer













          There is no a silver formula which tells you exactly the numbers behind. It all depends on particular implementation on kernel scheduler side.



          If you're interested in details, you can check priority logic of default Linux kernel scheduler (Completely Fair Scheduler) e.g. here.



          Copy-paste-for-the-future-visitors (in case the link will expire after a few years):




          Priorities



          Every process has two priorities associated with it. One is called as
          nice value of process. It ranges from -20 to 19, default being 0.
          Lower the nice value, higher the priority. If there are two processes
          having nice value as 5 (process 1)and 10 (process 2), process 1 has
          high priority.



          We can check nice values of process’s nice values using ps -el command
          on shell. In Kernel space it is translated as MAX_RT_PRIORITY + 20 +
          nice value. It is stored in static_prio field of the task_struct.



          Second priority is real-time priority. These have opposite notion,
          means higher the value, higher the priority of the process. It ranges
          from 0 to 100.



          There is one more field which is present in task_struct called as
          prio, which in turn stores the effective priority of process which is
          being considered by scheduler to boost or thwart priority in order to
          avoid cases like priority inversion.



          In earlier schedulers priority values were used in decided the next
          process and the time slice it gets on the processor. There were many
          short-comings in that approach , very well described in book “Linux
          Kernel Development” by Robet Love.



          In CFS, instead of using priorities to decide absolute time a process
          gets on processor, portion of processor time a process ought to get on
          processor was calculated, based on the overall load of the system. If
          a process is getting less than what it should get, it will eventually
          move towards the left side of RB tree and get the processor time.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          rushrush

          19.5k46696




          19.5k46696







          • 1





            Do you have a license to copy-paste that content?

            – Stephen Kitt
            yesterday











          • Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

            – Luigi Capogrosso
            yesterday












          • 1





            Do you have a license to copy-paste that content?

            – Stephen Kitt
            yesterday











          • Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

            – Luigi Capogrosso
            yesterday







          1




          1





          Do you have a license to copy-paste that content?

          – Stephen Kitt
          yesterday





          Do you have a license to copy-paste that content?

          – Stephen Kitt
          yesterday













          Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

          – Luigi Capogrosso
          yesterday





          Thank you very much, but I think that at the kernel level there is a function that calculates this value, right?

          – Luigi Capogrosso
          yesterday










          Luigi Capogrosso is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          Luigi Capogrosso is a new contributor. Be nice, and check out our Code of Conduct.












          Luigi Capogrosso is a new contributor. Be nice, and check out our Code of Conduct.











          Luigi Capogrosso is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511921%2fhow-does-the-kernel-assign-the-nice-value-to-a-process-after-it-has-been-execute%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







          -cpu, nice, priority, process, scheduling

          Popular posts from this blog

          Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

          Frič See also Navigation menuinternal link

          Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant