What Is the PRI Column in htop?
This article provides a quick overview of the “PRI” column in the
htop Linux command-line tool, explaining its core meaning,
how it relates to process scheduling, and how it interacts with the “NI”
(Nice) value. You will learn how Linux determines process priority and
how to interpret these numbers when monitoring system performance.
Understanding PRI in htop
In the htop interface, PRI stands for
Priority. It represents the internal scheduling priority
assigned to a process by the Linux kernel. Essentially, the PRI value
tells you how much urgency the kernel’s scheduler gives to a particular
process when distributing CPU time. A lower PRI value means a higher
priority, meaning the process gets CPU attention faster than processes
with higher numbers.
How PRI and NI (Nice Value) Work Together
The PRI column is deeply interconnected with the NI column, which stands for Nice value.
- Nice Value (NI): This is a user-controlled value that ranges from -20 (highest priority) to 19 (lowest priority). A default, unaltered process starts with a Nice value of 0.
- Kernel Priority (PRI): The kernel uses the Nice value to calculate the final PRI.
For standard user processes (often called non-real-time processes), the Linux kernel typically calculates the PRI using a simple mathematical baseline:
$$ = + 20$$
Because of this formula, a standard process with a default Nice value
of 0 will show a PRI of 20 in htop. If you “renice” a
process to make it less urgent—say, an NI of 10—its PRI value will
adjust to 30. Conversely, if you grant a process maximum urgency with an
NI of -20, its PRI will drop to 0.
Real-Time Priorities in htop
When looking at htop, you might occasionally see
negative numbers in the PRI column or the literal text
RT.
- RT / Negative Numbers: These indicate Real-Time processes. Real-time processes operate outside the standard 0 to 39 PRI range used by regular applications.
- System Crucial Tasks: The kernel schedules these processes with absolute preference to ensure critical system tasks (like audio processing or hardware drivers) face zero delays, regardless of how busy the CPU is with regular user software.