4. Operate Running Systems
πRed Hat Certified System Administrator (RHCSA β EX200)
Objective of This Section
In the RHCSA (EX200) exam, under 4. Operate Running Systems, the sub-topic 4.5 Adjust process scheduling tests your ability to:
- Change the priority of running processes
- Start programs with a specific priority
- Understand how Linux schedules CPU time
- Use commands like
nice,renice, and understand priority values
You must be comfortable working from the command line.
1. What Is Process Scheduling?
In Linux, many processes run at the same time. But the CPU can only execute one instruction at a time per core.
So the system uses a scheduler to decide:
- Which process runs first
- How long it runs
- Which process gets more CPU time
This decision is based on priority.
2. Understanding Process Priority
In Linux (including Red Hat Enterprise Linux (RHEL)), each process has:
- Priority value (PR) β Used internally by the kernel
- Nice value (NI) β Value you can control
For the RHCSA exam, you mainly work with the nice value.
2.1 Nice Value (NI)
The nice value determines how βniceβ a process is to other processes.
- Range: -20 to 19
- Default: 0
Important Rules:
| Nice Value | Meaning |
|---|---|
| -20 | Highest priority |
| 0 | Default priority |
| 19 | Lowest priority |
Very Important for Exam:
- Lower nice value = Higher priority
- Higher nice value = Lower priority
2.2 Who Can Set Negative Nice Values?
- Normal users β Can only set 0 to 19
- Root user β Can set -20 to 19
This is a common exam test point.
3. Viewing Process Priority
To check running processes and their nice values:
ps -el
or
top
In top, look for:
- PR β Priority
- NI β Nice value
Example IT Scenario
On a server running:
- A database service
- A backup script
- A log processing script
You may want:
- Database β higher priority
- Backup β lower priority
This ensures important services run smoothly.
4. Starting a Process with a Specific Nice Value
Use the nice command.
Syntax
nice -n value command
Example
Start a backup script with low priority:
nice -n 10 ./backup.sh
This means:
- The process runs with nice value 10
- Lower priority than default
Start with High Priority (Root Only)
nice -n -5 ./critical_script.sh
Only root can set negative values.
5. Changing Priority of a Running Process
Use the renice command.
Syntax
renice value -p PID
Step-by-Step Example
- Find PID:
ps aux | grep backup
- Change nice value:
renice 15 -p 1234
This changes process 1234 to nice value 15.
Important Notes for Exam
renicerequires:- Root β to increase priority (lower nice value)
- Normal user β can only increase nice value (lower priority)
6. Understanding Scheduler Behavior (Basic Level for Exam)
Linux uses a scheduler that:
- Gives CPU time to all processes
- Gives more CPU time to higher priority processes
- Prevents one process from using 100% CPU permanently
You do NOT need deep kernel knowledge for RHCSA.
Focus on:
- Nice values
- Using
nice - Using
renice - Viewing process priority
7. Real IT Use Cases
These are realistic server scenarios:
1. Database Server
mysqldprocess must respond quickly- Log cleanup script is not urgent
Set:
- Database β higher priority
- Log script β lower priority
2. Web Server with Background Jobs
- Apache or Nginx must serve users fast
- Background report generation can be slower
Run report generator with:
nice -n 15 ./generate_report.sh
3. Large File Compression
Compressing large log files:
nice -n 19 tar -czf logs.tar.gz /var/log
This prevents CPU overload.
8. Important Commands Summary
Check processes
ps -el
top
Start with specific nice value
nice -n 5 command
Change running process priority
renice 10 -p PID
9. Exam Tips (Very Important)
For RHCSA:
You should be able to:
β Start a process with lower priority
β Change nice value of a running process
β Understand nice value range
β Know who can set negative values
β Use ps and top to verify
Common Mistakes
β Thinking 19 is highest priority (It is lowest)
β Forgetting only root can set negative values
β Mixing up priority and nice values
10. Practice Tasks for Exam Preparation
You should practice:
- Start
sleep 500with nice value 10 - Change its nice value to 15
- Try setting nice value -5 as normal user (see error)
- Switch to root and try again
Final Quick Revision Table
| Task | Command |
|---|---|
| View processes | ps -el |
| Real-time process view | top |
| Start with priority | nice -n value command |
| Change running process | renice value -p PID |
| Nice range | -20 to 19 |
| Default nice | 0 |
What You Do NOT Need for RHCSA
- Kernel tuning
- Real-time scheduling classes
- Advanced CPU affinity tools
- CFS algorithm details
Final Words
For RHCSA EX200, adjusting process scheduling mainly means:
- Understanding nice values
- Using
niceandrenicecorrectly - Knowing how priority affects CPU usage
