When you form your command line using /bin/nice, you fill in the increment field with a number between 1 and 19. If you do not fill in a number, a default of 10 is assumed. The higher the number you use for the increment, the lower your process' priority will be (19 is the lowest possible priority; all numbers greater than 19 are interpreted as 19). The csh(1) shell has its own internal nice functions, which operate differently from the nice command, and are documented in the csh(1) reference page.nice [ -increment ] command
After entering the nice command and the increment on your command line, give the command as you would ordinarily enter it. For example, if the user ''joe'' wants to make his costly compile command described in the ps -ef listing above happen at the lowest possible priority, he forms the command line as follows:
If a process is invoked using nice, the total amount of CPU time required to execute the program does not change, but the time is spread out, since the process executes less often.nice -19 cc -o prog prog.c
The superuser (root) is the only user who can give nice a negative value and thereby increase the priority of a process. To give nice a negative value, use two minus signs before the increment. For example:
The above command endows that process with the highest priority a user process may possess. The superuser should not use this feature frequently, as even a single process that has been upgraded in priority causes a significant system slowdown for all other users. Note that /bin/csh has a built-in nice program that uses slightly different syntax than that described here. For complete information on csh, see the csh(1) reference page.nice --19 cc -o prog prog.c
The npri command allows users to make their process' priority nondegrading. In the normal flow of operations, a process loses priority as it executes, so large jobs typically use fewer CPU cycles per minute as they grow older. (There is a minimum priority, too. This priority degradation simply serves to maintain performance for simple tasks.) By using npri, the user can set the nice value of a process, make that process non-degrading, and also set the default time slice that the CPU allocates to that process. npri also allows you to change the priority of a currently running process. The following example usage of npri sets all the possible variables for a command:
In this example, the -h flag sets the nondegrading priority of the process, while the -n flag sets the absolute nice priority. The -t flag sets the time slice allocated to the process. IRIX uses a 10-millisecond time slice as the default, so the example above sets the time slice to 30 milliseconds. For complete information about npri and its flags and options, see the npri(1) reference page.npri -h 10 -n 10 -t 3 cc -o prog prog.c
In the most commonly used form, renice is invoked on a specific process that is using system time at an overwhelming rate. However, you can also invoke it with the -u flag to lower the priority of all processes associated with a certain user, or with the -g flag to lower the priorities of all processes associated with a process group. More options exist and are documented in the renice(1M) reference page.renice increment pid [-u user] [-g pgrp]
The npri command can also be used to change the parameters of a running process. This example changes the parameters of a running process with npri:
The superuser can use renice or npri to increase the priority of a process or user, but this can severely impact system performance.npri -h 10 -n 10 -t 3 -p 11962