Need Assistance?

In only two hours, with an average response time of 15 minutes, our expert will have your problem sorted out.

Server Trouble?

For a single, all-inclusive fee, we guarantee the continuous reliability, safety, and blazing speed of your servers.

How to Control Process Priority in Linux — Using nice and renice

Table of Contents

On a busy Linux server, where multiple applications, services, or background jobs are running —competing for system resources is a natural consequence. You might face slowdowns, high CPU usage, or unresponsive services. To manage such situations, Linux provides built‑in tools to influence process scheduling: nice and renice. These let you assign or change the priority of processes so critical ones get more CPU time, and less critical ones back off.

In this blog, you’ll learn:

  • How Linux scheduling and priorities work
  • What “niceness” is and how it maps to priority
  • How to view process priorities
  • How to launch processes with nice
  • How to adjust running processes with renice
  • Best practices and caveats

This gives you a finer level of control over system load and responsiveness.

1. How Linux scheduling and priorities work

A process is an instance of a running program, identified by its own unique number and allocated its own namespace and system resources. All running processes are managed by the operating system, which is responsible for scheduling, resource allocation, and tracking process states. There are hundreds of processes running on a typical linux system at a time, which include critical system processes that ensure smooth operation and user processes that serve various functions.

The kernel (via its scheduler) decides when each process gets CPU time. Processes with higher priorities consume more CPU time compared to lower-priority processes. This prioritization ensures critical operations receive the necessary resources to execute, even when the system is overwhelmed with requests.

2. What “niceness” is and how it maps to priority

The concept of ‘niceness’ determines the scheduling priority of processes.Each process in Linux is assigned a nice value, which influences its scheduling priority during execution. 

Linux nice values range from -20 to 19, where -20 represents the highest priority and 19 the lowest. The term “nice” refers to how considerate a process is toward others when competing for CPU time. A higher nice value (e.g., 19) means the process is more “polite,” yielding CPU time to others — effectively lowering its own priority. Conversely, a lower nice value (e.g., -20) makes a process more aggressive in claiming system resources, granting it a higher priority in the scheduler’s decisions. Processes start with a Linux nice value of 0, representing the standard — or neutral — priority.

3. Checking Process Priorities

You can view the current priorities and nice values using commands like:

ps -axl | grep process_name

The output shows PRI (priority) and NI (nice) columns. Tools like top, htop or atop provide dynamic, real‑time views, which are used to determine the Linux nice value and priority level of the system and user processes.

4. Using nice to Launch with a Priority

The nice command in Linux lets you start processes with modified priority levels, influencing how they’re scheduled by the system. To start a process with a custom niceness:

nice -n [nice_value] command

For instance,

nice -n -10 report-generator

requests a higher priority. Positive values (lower priority) may omit the +.

5. Using renice to Modify Running Processes

If a process is already running, you can change its niceness using:

renice [new_nice_value] -p [PID]

To adjust a process’s nice value by a relative amount, use the –relative option. This increments or decrements the current niceness by the specified value, rather than setting an absolute value.

renice --relative [relative amount] -p [process ID (PID)]

You may increase (lower priority) any process you own; decreasing (raising priority) typically requires root privileges. You can also adjust all processes of a specific user via.

renice [new_nice_value] -u username
renice [new_nice_value] -u UID

Conclusion

Managing process priority is crucial in high‑demand server environments. The nice and renice commands let server admins control how much CPU time each process gets, ensuring that critical tasks stay responsive. While modern servers are powerful and scheduling is often automatic, these tools remain valuable for fine‑tuning performance when needed.

If you need help fine-tuning your Linux environment, monitoring performance, or ensuring optimal resource allocation, our team is here to help. With our comprehensive Server Management services, we provide 24/7 support, performance optimization, and proactive monitoring to keep your systems running smoothly.

Liked!! Share the post.

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Let us know your requirement.

Can't get what you are looking for?

Get Support Right Away!