System administration: Difference between revisions

Jump to navigation Jump to search
dump from oldwiki
→‎Debian/Ubuntu-specific: add Setting niceness (aka priority) on Linux processes
Line 278: Line 278:
$ dpkg-reconfigure tzdata
$ dpkg-reconfigure tzdata
</syntaxhighlight>
</syntaxhighlight>
== Setting niceness (aka priority) on Linux processes ==
*Tested on: Ubuntu 12.04 Precise
*Difficulty: 1/10
*Time: <1 minute + your WPM
Niceness or nice value in Linux is just another name for the value of priority given to a process. The higher the number means the lower the priority. The nice value can also be negative, and such values will give a process higher than normal priority. Higher the priority (or lower the nice value), the more CPU time is given, therefore the application will be perceived as running faster.
As an example, let's say the process of interest is ''qemu-system-arm''. You have to find out what PID (Process ID) is first.
<source lang="bash">
$ pidof qemu-system-arm
3016
</source>
Then check what the current nice value of the process is:
<source lang="bash">
$ ps -o pid,comm,nice -p 3016
  PID COMMAND        NI
3016 qemu-system-arm  0
</source>
According to the output, the nice value of ''qemu-system-arm'' is 0. We want to '''decrease''' the nice value to dedicate more CPU time to it. However, you need sudo privilege in order to give a negative value for a nice value, even though you do not need such privilege for increasing the nice value to something above 0. Here we decrease it to -10.
<source lang="bash">
$ sudo renice -10 -p 3016
</source>
To set a permanent priority on all processes for a specific user or a group you can update ''/etc/security/limits.conf'' file.
===References===
http://www.nixtutor.com/linux/changing-priority-on-linux-processes/ (accessed on July 22, 2012)