Performance Checklist
In this lab, students will locate and manage processes that are using the most resources on a system.
Outcomes
Experience using top as a process management tool.
Run lab processes setup as root
on serverX to prepare for this exercise.
[root@serverX ~]#lab processes setup
Perform the following tasks as student on the serverX
machine.
In a terminal window, run the top utility. Size the window to be as tall as possible.
[student@serverX ~]$toptop - 12:47:46 up 2:02, 3 users, load average: 1.67, 1.25, 0.73 Tasks: 361 total, 6 running, 355 sleeping, 0 stopped, 0 zombie %Cpu(s): 98.5 us, 1.4 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st KiB Mem: 2043424 total, 897112 used, 1146312 free, 1740 buffers KiB Swap: 4079612 total, 0 used, 4079612 free. 296276 cached Me PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4019 root 20 0 4156 76 0 R 57.5 0.0 2:54.15 hippo 2492 student 20 0 1359500 168420 37492 S 16.8 8.2 3:55.58 gnome-shell 1938 root 20 0 189648 35972 7568 R 1.9 1.8 0:29.66 Xorg 2761 student 20 0 620192 19688 12296 S 0.4 1.0 0:04.48 gnome-termi+ output truncated
Observe the top display. The default display sorts by CPU utilization, highest first. What are the processes using the most CPU time?
Change the display to sort by the amount of memory in use by each process.
top - 12:57:38 up 2:11, 3 users, load average: 2.09, 1.70, 1.19
Tasks: 360 total, 5 running, 355 sleeping, 0 stopped, 0 zombie
%Cpu(s): 99.8 us, 0.2 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 2043424 total, 896952 used, 1146472 free, 1740 buffers
KiB Swap: 4079612 total, 0 used, 4079612 free. 296280 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2492 student 20 0 1359500 168420 37492 S 0.5 8.2 4:01.04 gnome-shell
4013 root 20 0 55360 51208 152 S 0.0 2.5 0:00.43 elephant
1938 root 20 0 189648 35972 7568 R 0.2 1.8 0:30.49 Xorg
2576 student 20 0 533752 33684 27784 S 0.1 1.6 0:09.29 vmtoolsd
2420 student 20 0 916268 25616 14404 S 0.0 1.3 0:00.61 gnome-setti+
2550 student 20 0 1048204 23136 16060 S 0.0 1.1 0:00.46 nautilus
output truncatedWhat are the processes with the largest memory allocations?
Turn off the use of bold in the display. Save this configuration for reuse when top is restarted.
| Press the single uppercase keystroke B to toggle bold use off. |
Press the single uppercase keystroke W to save this configuration.
The default configuration file is .toprc in the current user's home directory.
|
Exit top, then restart it again. Confirm that the new display uses the saved configuration; i.e., the display starts sorted by memory utilization and bold is turned off.
[student@serverX ~]$top
Modify the display to again sort by CPU utilization.
Turn on the use of bold. Observe that only Running
or Runnable (state R) process entries are bold.
Save this configuration.
| Press the single uppercase keystroke P to sort by CPU utilization. |
| Press the single uppercase keystroke B to toggle bold use on. |
| Press the single uppercase keystroke W to save this configuration. |
Open another terminal window if necessary.
As root, suspend the hippo process.
In top, observe that the process state is now T.
[student@serverX ~]$su -Password:redhat[root@serverX ~]#pkill -SIGSTOP hippo
The hippo process quickly disappears from the display, since it is no longer actively using CPU resources. List the process information from the command line to confirm the process state.
[root@serverX ~]#ps -f $(pgrep hippo)
Resume execution of the hippo processes.
[root@serverX ~]#pkill -SIGCONT hippo
When finished observing the display, terminate the extra processes elephant and hippo using the command line. Confirm that the processes no longer display in top.
[root@serverX ~]#pkill elephant[root@serverX ~]#pkill hippo
Check that the cleanup is successful by running the grading script. If necessary, find and terminate processes listed by the grading script, and repeat grading.
[root@serverX ~]#lab processes grade
Exit the top display. Close extra terminal windows.