change linux process priority

5,728

Solution 1

How can I change priority of that process?

renice priority [-p] pid

Useful priorities are: 20 (the affected processes will run only when nothing else in the system wants to), 0 (the ``base'' scheduling priority), anything negative (to make things go very fast)

Example: renice -5 -p 123, 123 is process PID, -5 is priority

Will it speedup my application processing?

No, if load average less number of CPU core.

Solution 2

You can change priority with renice command. It will speed up processing only if there are other applications actively consuming CPU time.

Share:
5,728
user62648
Author by

user62648

Updated on September 17, 2022

Comments

  • user62648
    user62648 over 1 year

    I ran a jar file in Linux and it is running from last 3 days.

    How can I change priority of that process? Will it speedup my application processing?

    • coredump
      coredump over 13 years
      3 days? Are you sure it still processing something?
    • halp
      halp over 13 years
      I like to use the term niceness in the context of nice/renice tools. This is because there are also other aspects which affect how much CPU a process can get. For example see scheduling attributes and chrt.
  • user62648
    user62648 over 13 years
    Thanks for your reply. There is no other process running on my computer. Will it make a big diff. to change priority? I checked my process priority and it is 0. What does it mean?
  • BillThor
    BillThor over 13 years
    The default priority will share equally among running processes. Nicing the process is usually used to allow other processes to run faster, slowing the niced process if other processes are running. Negative priorities require root privileges, and can halt all other processes. Avoid them for anything CPU intensive.
  • DerfK
    DerfK over 13 years
    The key to remember is that the number is how nice the process is to others. a big number means it is very nice. a negative number means it is not nice at all and won't let the other processes play.