Process Priority nice Calculator
Calculate effective process priority from nice value and scheduling class.
About Process Priority nice Calculator
Linux nice values (-20 highest priority to 19 lowest, default 0) map to CFS scheduling weights via a fixed table (sched_prio_to_weight in the kernel source) where nice 0 = weight 1024 and each nice step changes weight by a factor of roughly 1.25 — not linearly. Under CPU contention, each runnable task's share of available CPU time is approximately its own weight divided by the sum of all competing runnable tasks' weights, which is why a single nice -20 process can dominate CPU time when competing against several nice 0 processes, while the same nice -20 process barely matters if it's the only thing running (nice values only affect relative scheduling under contention, not absolute CPU limits).
Formula
CPU share under contention
cpu_share% = task_weight / sum(all_competing_weights) × 100
- w_i
- this task's weight (from its nice value)
- "\\sum_j w_j"
- sum of weights of all competing runnable tasks
Worked example
With the default values below, Process Priority nice Calculator returns CFS Scheduling Weight of 1,024. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Nice Value (-20 highest priority to 19 lowest)accepts -20–19
- 0
- Other Competing Processes' Nice Values (comma-separated)
- 0, 0, 5
Results
- CFS Scheduling Weight
- 1,024
- Estimated CPU Share (vs. listed competitors)
- 30.06%
- vruntime Rate vs. Nice 0 (×)
- 1.000
- Total Processes in Comparison
- 4
Step by step
- 1Values used
- 2CPU share under contention
- 3CFS Scheduling Weight= 1,024
- 4Estimated CPU Share (vs. listed competitors)= 30.06
- 5vruntime Rate vs. Nice 0 (×)= 1.000
- 6Total Processes in Comparison= 4
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 3 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Does setting nice -20 guarantee a process gets priority over everything else?
No — it only increases its relative weight in CFS's proportional-share scheduling among currently runnable tasks; it doesn't grant real-time priority or preempt I/O-bound waiting. For genuine hard real-time guarantees, you'd need SCHED_FIFO/SCHED_RR real-time scheduling policies (via chrt), which operate under entirely different rules than the standard CFS nice-value system.
Why is the nice-to-weight relationship roughly a 1.25× factor per step, not linear?
The kernel's sched_prio_to_weight table is designed so that each single nice-value step changes a task's CPU time share by a consistent ~10% relative factor when running against nice 0 competitors, and this consistent percentage relationship falls out of a roughly exponential (geometric) weight table rather than a linear one.
Can a normal (non-root) user set a negative nice value?
Not by default — lowering nice (increasing priority) below 0 requires the CAP_SYS_NICE capability, typically only available to root or processes explicitly granted that capability; unprivileged users can only raise their own processes' nice values (lower priority), not lower them, to prevent unprivileged priority abuse.
