Skip to content
Calcrivo

Process Priority nice Calculator

Calculate effective process priority from nice value and scheduling class.

Inputs

Leave blank to just see this process's weight in isolation

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

  1. Values used

    Nice Value (-20 highest priority to 19 lowest) = 0; Other Competing Processes' Nice Values (comma-separated) = 0, 0, 5

  2. CPU share under contention

    cpu_share% = task_weight / sum(all_competing_weights) × 100

  3. CFS Scheduling Weight

    = 1,024

  4. Estimated CPU Share (vs. listed competitors)

    = 30.06

  5. vruntime Rate vs. Nice 0 (×)

    = 1.000

  6. Total Processes in Comparison

    = 4

How it works

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

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.

You might also need