SYS: Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes.

Share this link

Note: This is an RHCSA 7 exam objective.

System Activities

To get an instantaneous image of a server activity (use ‘virt-top‘ on a KVM hypervisor), type:

# top

To get details about processes, type:

# ps -edf

Process Priority

To start a process (here script.sh) with a low priority, type:

# nice -n 10 ./script.sh

To change the priority (here +5) of an already running process, get its PID (Process ID) through top or ps (here 789) and type:

# renice +5 789

Alternatively:

# renice +5 `pgrep script.sh`

Process Deletion

To kill the process, get its PID through top or ps (here 789) and type:

# kill -9 789

Alternatively:

# pkill script.sh

System Reporting

To display details about IO activities, type:

# iostat

To show network card activities, type:

# netstat -i

To display socket activities, type:

# netstat -a

To get details about virtual memory activities (memory, swap, run queue, cpu usage, etc) every 5 second, type:

# vmstat 5

To get a full report of a server activity, type:

# sar -A

Additional Resources

You can also watch a video by Sander van Vugt about Understanding Linux Memory Usage (4min/2016).

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

3 Comments on "SYS: Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes."

Notify of
Sort by:   newest | oldest
val
Member
val

Just a comment about `kill -9` This is not the default behavior and rarely used on for well written programs. `kill` sends SIGTERM as default to a process so the process needs time for a clean up of open files, FD’s etc.

Gjorgi
Member
Gjorgi

I guess PackageKit isn’t a well written program, since I have to put up a fight with it first via several kill -9 on it before being able to use yum install to install stuff on my virtual CentOS installation.

wpDiscuz

RHCSA7: Task of the day

Allowed time: 5 minutes.
Set up time services pointing to default time servers.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a httpd virtual server called "dummy" with DocumentRoot assigned to /opt.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...