Linux System Administration - X


Add to my manuals
368 Pages

advertisement

Linux System Administration - X | Manualzz

process priorities

2.1.4. top

Just running top without options or arguments will display all processes and an overview of innformation. The top of the top screen might look something like this.

top - 13:59:29 up 48 min, 4 users, load average: 1.06, 0.25, 0.14

Tasks: 139 total, 3 running, 136 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.3%us, 99.7%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 509352k total, 460040k used, 49312k free, 66752k buffers

Swap: 746980k total, 0k used, 746980k free, 247324k cached

Notice the cpu idle time (0.0%id) is zero. This is because our cat processes are consuming the whole cpu. Results can vary on systems with four or more cpu cores.

2.1.5. top -p

The top -p 1670,1671,1673,1674 screenshot below shows four processes, all of then using approximately 25 percent of the cpu.

paul@ubuntu910:~$ top -p 1670,1671,1673,1674

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

1674 paul 20 0 2972 616 524 S 26.6 0.1 0:11.92 proj42

1670 paul 20 0 2972 616 524 R 25.0 0.1 0:23.16 proj33

1671 paul 20 0 2972 616 524 S 24.6 0.1 0:23.07 proj33

1673 paul 20 0 2972 620 524 R 23.0 0.1 0:11.48 proj42

All four processes have an equal priority (PR), and are battling for cpu time. On some systems the Linux kernel might attribute slightly varying priority values, but the result will still be four processes fighting for cpu time.

2.1.6. renice

Since the processes are already running, we need to use the renice command to change their

nice value (NI).

The screenshot shows how to use renice on both the proj33 processes.

paul@ubuntu910:~$ renice +8 1670

1670: old priority 0, new priority 8 paul@ubuntu910:~$ renice +8 1671

1671: old priority 0, new priority 8

Normal users can attribute a nice value from zero to 20 to processes they own. Only the

root user can use negative nice values. Be very careful with negative nice values, since they can make it impossible to use the keyboard or ssh to a system.

17

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents