A common Linux misconception is that a process with a higher nice value receives a fixed percentage of the CPU. It does not. The nice value adjusts the process’s scheduling weight, which matters when runnable processes compete for limited CPU time.
Consider a CPU-intensive job changed from the default priority:
nice -n 10 long-running-task
The value 10 does not mean “use 10% of one CPU.” It tells the Linux scheduler to give the task less weight relative to competing work.
If the machine has an otherwise idle CPU, the nice process can still consume that CPU completely. There is no reason for the scheduler to leave processing capacity unused merely because the only runnable task has a low weight. The difference becomes visible when another runnable task wants the same CPU.
For two continuously runnable tasks competing on one CPU, the approximate effect looks like this:
| Task A | Task B | Approximate CPU split |
|---|---|---|
| nice 0 | nice 0 | 50% / 50% |
| nice 0 | nice 5 | 75% / 25% |
| nice 0 | nice 10 | 90% / 10% |
These figures illustrate relative weighting, not guaranteed quotas. Real results can differ because tasks sleep, wake, migrate between CPUs, or run inside scheduling groups and cgroups.
This explains why applying nice to a background compression job may appear to do nothing at first. While the system is quiet, compression can use all available CPU capacity. When an interactive application becomes runnable, the scheduler favors the application more strongly, and the background job yields a larger portion of CPU time.
The mechanism is also different from a CPU limit. A low-priority task may still finish quickly when spare capacity exists. Conversely, nice alone does not impose a hard ceiling that prevents a task from exceeding some chosen percentage.
The corrected claim is precise: nice controls relative access to CPU time under contention. It neither reserves CPU capacity nor sets an absolute utilization limit. That makes it useful for letting opportunistic work proceed aggressively when resources are free while reducing its impact when more important work arrives.
Top comments (0)