<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Nice values for background processes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792208#M943643</link>
    <description>An HP White Paper titled "HP-UX 10.0 Process Management White Paper" states the following about process priority and nice:&lt;BR /&gt;&lt;BR /&gt;All processes have a priority, set when the process is invoked and based on factors such as who is running the process (user, system) and whether the process is created in a time-share or real-time environment.&lt;BR /&gt;&lt;BR /&gt;The nice command can be used to set a process to run at a lower priority than would be set by default.  nice does not lower the priority of an already running process.  nice is useful for running programs whose execution time is not critical.&lt;BR /&gt;&lt;BR /&gt;For example, suppose you have a program, named numcrunch, that manipulates large arrays of data, but the data is not critical to your work at the moment.  How long it takes for the program to manipulate the data is unimportant; more critical programs should have greater access to CPU resources.  To run numcrunch as a low priority background process, type:&lt;BR /&gt;&lt;BR /&gt; $ nice numcrunch &amp;amp;&lt;BR /&gt;&lt;BR /&gt;Note that both Korn and C shells handle nice slightly differently: ksh automatically lowers priority of background processes by four; this behavior can be modified using the bgnice argument.  If you specify nice from ksh, it executes /usr/bin/nice and lowers priority by ten.&lt;BR /&gt;&lt;BR /&gt;If you specify nice from csh, it executes its built-in command and lowers priority by four; however, if you specify /usr/bin/nice, csh lowers priority by ten.&lt;BR /&gt;&lt;BR /&gt;For details, see nice(1), ksh(1), csh(1), renice(1M), and nice(2) in the HP-UX Reference.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
    <pubDate>Thu, 22 Aug 2002 20:02:12 GMT</pubDate>
    <dc:creator>Brant Evans</dc:creator>
    <dc:date>2002-08-22T20:02:12Z</dc:date>
    <item>
      <title>Nice values for background processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792207#M943642</link>
      <description>Ok,  Here's the deal, I understand that executing processes in the background (with &amp;amp;) by default get a nice value of 24 instead of the standard 20..  &lt;BR /&gt;&lt;BR /&gt;But why is it that if I launch a process in the background within a shell script, this rule does not hold true?&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;$sleep 999 &amp;amp;&lt;BR /&gt;[1]     21398&lt;BR /&gt;$ps -elf|grep sleep|grep -v grep&lt;BR /&gt;  1 S   oracle 21398 20571  0 168 24         50db4540   16         49a9a100 14:49:56 pts/3     0:00 sleep 999&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But, if I run the following script..&lt;BR /&gt;&lt;BR /&gt;$cat sleeptest&lt;BR /&gt;sleep 9999 &amp;amp;&lt;BR /&gt;&lt;BR /&gt;$./sleeptest                    &lt;BR /&gt;$ps -elf|grep sleep|grep -v grep&lt;BR /&gt;  1 S   oracle 21489     1  0 168 20         4fddbcc0   16         4dd28140 14:51:44 pts/3     0:00 sleep 9999&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The nice value is now 20?  Is this right?  It must be, but can someone explain to me why?&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Aug 2002 19:51:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792207#M943642</guid>
      <dc:creator>David Snider</dc:creator>
      <dc:date>2002-08-22T19:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Nice values for background processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792208#M943643</link>
      <description>An HP White Paper titled "HP-UX 10.0 Process Management White Paper" states the following about process priority and nice:&lt;BR /&gt;&lt;BR /&gt;All processes have a priority, set when the process is invoked and based on factors such as who is running the process (user, system) and whether the process is created in a time-share or real-time environment.&lt;BR /&gt;&lt;BR /&gt;The nice command can be used to set a process to run at a lower priority than would be set by default.  nice does not lower the priority of an already running process.  nice is useful for running programs whose execution time is not critical.&lt;BR /&gt;&lt;BR /&gt;For example, suppose you have a program, named numcrunch, that manipulates large arrays of data, but the data is not critical to your work at the moment.  How long it takes for the program to manipulate the data is unimportant; more critical programs should have greater access to CPU resources.  To run numcrunch as a low priority background process, type:&lt;BR /&gt;&lt;BR /&gt; $ nice numcrunch &amp;amp;&lt;BR /&gt;&lt;BR /&gt;Note that both Korn and C shells handle nice slightly differently: ksh automatically lowers priority of background processes by four; this behavior can be modified using the bgnice argument.  If you specify nice from ksh, it executes /usr/bin/nice and lowers priority by ten.&lt;BR /&gt;&lt;BR /&gt;If you specify nice from csh, it executes its built-in command and lowers priority by four; however, if you specify /usr/bin/nice, csh lowers priority by ten.&lt;BR /&gt;&lt;BR /&gt;For details, see nice(1), ksh(1), csh(1), renice(1M), and nice(2) in the HP-UX Reference.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Thu, 22 Aug 2002 20:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792208#M943643</guid>
      <dc:creator>Brant Evans</dc:creator>
      <dc:date>2002-08-22T20:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nice values for background processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792209#M943644</link>
      <description>David,&lt;BR /&gt;&lt;BR /&gt;your first example shows that the sleep command is executed along with the &amp;amp; sign directly from your shell. This means the PID of the shell is the parent process (PPID) of the sleep command. The shell, therefore, lowers the nice value, because the shell launches the sleep command. See Brant's explanation.&lt;BR /&gt;&lt;BR /&gt;In your 2nd example, the sleep command is not launched by the shell but by the script 'sleeptest'. The shell launches the script 'sleeptest' using the nice value for normal interactive processes (because there is no &amp;amp; sign appended to './sleeptest'). 'sleeptest' itself is the parent process for the sleep command, but hasn't changed the nice value of the sleep command, despite of the &amp;amp; sign. So, the sleep command gets the nice value of its parent process ('slepptest'). As you can see, the PPID of the sleep command is no longer that of 'sleeptest'. That's because 'sleeptest' immediatly exited after launching the sleep command. Therefore, the PPID changed to 1 (init).&lt;BR /&gt;&lt;BR /&gt;I guess, if you'd executed './sleeptest &amp;amp;', then also the sleep command would run with the nice value 24.&lt;BR /&gt;&lt;BR /&gt;Only the shell renices jobs that are put into the background with the &amp;amp; sign. In the other cases (e.g. using scripts), you should explicitly use the nice commend for renicing.</description>
      <pubDate>Fri, 23 Aug 2002 12:38:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/nice-values-for-background-processes/m-p/2792209#M943644</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2002-08-23T12:38:56Z</dc:date>
    </item>
  </channel>
</rss>

