Lab 4.3 - Priorities and Nice Values
Objectives
- Understand nice values
- Adjust priorities with nice and renice
- Manage CPU-intensive processes
Exercise 1: Nice Values
# View current nice
nice
# Launch with nice value
nice -n 10 sleep 100 &
nice -n -10 sleep 200 & # High priority (requires sudo)
# View nice values
ps -eo pid,ni,cmd | head -10
Exercise 2: renice
# Launch a process
sleep 300 &
PID=$!
# Change priority
renice 10 $PID
# By user
sudo renice -5 -u $USER
Lab created on: December 2024 - Tested on Ubuntu 24.04