Study guide
6.5 Process Priorities: nice & renice (103.6)
LPIC-1 Linux Administrator — Exam 101 101-500
Track your progress as you read
Finished sections get a check mark.
1 Exam Overview & Study Strategy
1.1 LPIC-1 101-500 Exam Structure & Blueprint 1.2 Command Line & Shell Fundamentals for Exam Success 1.3 Fill-in-the-Blank Strategies & Common Traps
2 Topic 101: System Architecture
2.1 Hardware Discovery, Sysfs, Procfs & Kernel Modules (101.1) 2.2 Udev, Dbus & Device Management (101.1) 2.3 BIOS vs. UEFI & System Boot Process (101.2) 2.4 Kernel Initialization, Initramfs & System Logs (101.2) 2.5 Systemd Boot Targets & Unit Management (101.3) 2.6 SysVinit Runlevels, Telinit & System Shutdown (101.3)
3 Topic 102: Linux Installation & Boot Management
3.1 Hard Disk Layout, Partition Schemes & Swap Design (102.1) 3.2 LVM & Standard Mount Point Allocation (102.1) 3.3 GRUB 2 Configuration & Troubleshooting (102.2) 3.4 Legacy GRUB & Alternative Boot Loaders (102.2) 3.5 Managing Shared Libraries & ldconfig (102.3) 3.6 Linux as a Virtualization Guest & Cloud Instances (102.6)
4 Topic 102: Package Management Systems
4.1 Debian Low-Level Package Management with dpkg (102.4) 4.2 High-Level Debian Package Management: apt, apt-get & apt-cache (102.4) 4.3 RPM Package Management with rpm (102.5) 4.4 YUM, DNF & Zypper Package Management (102.5) 4.5 Package Repositories & Integrity Verification (102.4/102.5) 4.6 Universal Linux Packages: Snap, Flatpak & AppImage (102.4/102.5)
5 Topic 103: Command Line & Text Processing
5.1 Shell Environment, Environment Variables & Aliases (103.1) 5.2 Command History, Quoting & Expansion (103.1) 5.3 Basic Text Filters: cat, head, tail, cut, paste, nl, od (103.2) 5.4 Advanced Text Filters: sort, uniq, wc, tr, split, less & Checksums (103.2) 5.5 Stream Editing with sed (103.2) 5.6 Basic File Management: cp, mv, rm, touch, mkdir, rmdir (103.3) 5.7 Archiving and Compression: tar, gzip, bzip2, xz, cpio & dd (103.3)
6 Topic 103: Streams, Processes, Regex & Vi
6.1 Standard Streams, Redirection & File Descriptors (103.4) 6.2 Pipelines, tee & xargs (103.4) 6.3 Process Monitoring: ps, top, free, watch, pgrep, pstree & uptime (103.5) 6.4 Signals, kill, Job Control, nohup, screen & tmux (103.5) 6.5 Process Priorities: nice & renice (103.6) 6.6 Regular Expressions & grep, egrep, fgrep (103.7) 6.7 vi / vim Modes, plus nano, Emacs & EDITOR Awareness (103.8)
7 Topic 104: Devices, Partitions & Filesystems
7.1 Block Devices, fdisk & gdisk (104.1) 7.2 GNU Parted & Partition Table Management (104.1) 7.3 Creating Filesystems: mkfs, ext4, XFS, VFAT/exFAT & Btrfs (104.1) 7.4 Filesystem Integrity: fsck, e2fsck, xfs_repair, xfs_fsr & xfs_db (104.2) 7.5 Monitoring Disk Usage: df, du & tune2fs (104.2) 7.6 Managing Swap Space: mkswap, swapon & swapoff (104.1/104.2)
8 Topic 104: Mounts, Permissions, Links & FHS
8.1 Mounting and Unmounting Filesystems: mount & umount (104.3) 8.2 Persistent Mounts: /etc/fstab, UUIDs & systemd mount units (104.3) 8.3 Standard File Permissions: chmod, chown, chgrp & umask (104.5) 8.4 Special Permissions: SUID, SGID & Sticky Bit (104.5) 8.5 Hard Links vs. Symbolic Links: ln & Inodes (104.6) 8.6 Filesystem Hierarchy Standard (FHS) & File Location (104.7)
6.5 Process Priorities: nice & renice (103.6)
Key Takeaways Explain This Topic AI
The Linux kernel scheduling priority ranges across static niceness values from -20 (highest priority / least nice) to 19 (lowest priority / most nice), with default niceness for new processes set to 0 .
Under the Completely Fair Scheduler (CFS), the dynamic kernel priority (PR) corresponds directly to niceness: PR = 20 + NI \text{PR} = 20 + \text{NI} PR = 20 + NI .
Regular unprivileged users can only increase niceness (range 0 to 19, lowering their own scheduling priority); only the superuser ( root ) can assign negative niceness values (-20 to -1).
The nice command launches a NEW process with an adjusted priority offset, defaulting to +10 if invoked without arguments.
The renice command alters the ABSOLUTE niceness of ALREADY RUNNING processes by PID ( -p ), User ( -u ), or Process Group ( -g ).
Last updated: August 2026
6.5 Process Priorities: nice & renice
Quick Summary: In a multi-tasking operating system, the Linux Completely Fair Scheduler (CFS) dynamically allocates CPU execution time among competing processes. Scheduling decisions are guided by niceness ( NI ), an integer value spanning from -20 (highest priority / least nice to others) to 19 (lowest priority / most nice to others) . Administrators launch new programs with custom priority offsets using nice and alter the absolute priority of active processes using renice . Unprivileged users may only decrease their own priority, while root retains unrestricted priority control.
1. Linux CPU Scheduling, Dynamic Priority & Niceness
The standard Linux scheduler is the Completely Fair Scheduler (CFS) . Rather than using fixed time slices, CFS models an "ideal multi-tasking CPU" on hardware by tracking the virtual runtime ( vruntime ) of each task. Tasks with smaller virtual runtimes are scheduled next on available CPU cores.
Dynamic Priority vs. Static Niceness
When viewing process tables in top or ps , two related priority columns appear:
NI (Niceness): The user-configurable static priority modifier spanning from -20 to 19 (default: 0 ).
PR / PRI (Kernel Priority): The internal dynamic priority value used by the kernel scheduler.
For standard user-space processes scheduled under SCHED_OTHER / SCHED_NORMAL , the kernel computes dynamic priority using the direct mapping formula: PR = 20 + NI \text{PR} = 20 + \text{NI} PR = 20 + NI Niceness-to-Kernel Priority Mapping Spectrum:
- Niceness (NI): -20 ─── -15 ─── -10 ─── -5 ──── 0 ──── +5 ─── +10 ─── +15 ─── +19
- │ │ │
- ▼ ▼ ▼
- Priority (PR): 0 ───── 5 ──── 10 ──── 15 ──── 20 ──── 25 ──── 30 ──── 35 ──── 39
- [Highest CPU Time] [Default] [Lowest CPU Time]
- [Root Privilege Only] [Available to All Users]
- The Niceness Spectrum & Privilege Rules
Niceness Value ( NI ) Dynamic Priority ( PR ) CPU Scheduling Share Who Can Set This Value?
-20 to -1 0 to 19 High Priority: Receives significantly larger CPU time slices; preempts standard processes. Superuser ( root ) ONLY
0 20 Standard Priority: Default value assigned to all new processes launched by users and system services. All Users
1 to 19 21 to 39 Low Priority ("Nice"): Yields CPU time to standard processes; ideal for background batch jobs, backups, and video rendering. All Users (can only increase)
⚠️ LPIC-1 Trap — Niceness Logic is Inverted:
A LOWER numerical value means HIGHER CPU priority (a value of -20 is aggressive, not nice to other processes).
A HIGHER numerical value means LOWER CPU priority (a value of 19 is polite and nice to other processes).
Unprivileged users can only make their processes more nice (increase NI from 0 up to 19). They cannot lower niceness (even back to 0 once raised!).
2. Launching New Processes with nice
The nice command launches a new process with a specified niceness offset. It cannot modify an already running process.
- Command Syntax nice [OPTION] [COMMAND [ARG]...]
- Specifying Niceness Values
Modern Linux systems support the clean -n (or --adjustment ) flag: # 1. Launch a CPU-intensive backup with lower priority (NI = 10):
$ nice -n 10 tar -czf /backup/archive.tar.gz /data
# 2. Launch a high-priority database process with negative niceness (Root only):
$ sudo nice -n -10 mysqld_safe &
# 3. Default behavior when no flag is provided (Increments niceness by 10):
- $ nice tar -czf backup.tar.gz /data
- # Runs with niceness NI = 10
- Legacy Syntax Traps on the LPIC-1 Exam
On the LPIC-1 exam, you will encounter both modern -n syntax and legacy dash syntax:
nice -10 command → Runs command with a positive niceness of 10 (low priority).
nice --10 command → The first dash is the flag specifier; the second dash is the negative sign! This runs the command with a negative niceness of -10 (high priority, root only). # Legacy syntax comparison:
- $ nice -15 gzip bigfile.iso # Nice = +15 (Low priority)
- $ sudo nice --15 gzip bigfile.iso # Nice = -15 (High priority)
- 3. Modifying Running Processes with renice
The renice command alters the scheduling priority of one or more already active processes .
Key Architectural Difference Between nice and renice
Exam Rule — Relative vs. Absolute Values:
nice applies a relative adjustment / offset when launching a new program.
renice sets the ABSOLUTE target niceness value on running processes!
renice Command Syntax & Target Flags renice [-n] priority [[-p] pids] [[-g] pgrps] [[-u] users]
- Flag Target Scope Real-World Example
- p <PID> Target by Process ID (default if no flag specified) renice -n 5 -p 1042 1043
- u <user> Target all processes owned by Username or UID sudo renice -n 10 -u developer
- g <PGRP> Target all processes in a Process Group ID renice -n 8 -g 2048
Practical renice Demonstrations # Lower the priority of running PID 4812 to an absolute niceness of 15:
- $ renice -n 15 -p 4812
- 4812 (process ID) old priority 0, new priority 15
# Alternative shorthand syntax without -n or -p:
$ renice 15 4812
# Elevated priority (Root only): Set niceness of PID 1024 to -5:
- $ sudo renice -n -5 -p 1024
- 1024 (process ID) old priority 0, new priority -5
# Lower the priority of all processes belonging to user 'john':
- $ sudo renice 10 -u john
- Privilege Error Demonstration
If an unprivileged user attempts to assign a negative niceness or lower an existing niceness value, the kernel denies the syscall: $ renice -n -5 -p 4812
renice: failed to set priority for 4812 (process ID): Permission denied
💡 LPIC-1 Exam Fill-in-the-Blank Alert: What command is used to change the priority of an already running Linux process? Answer: renice