Is there a way to change the process scheduling policy of the whole system? For example, I want to change the default SCHED_OTHER to SCHED_RR for all processes. The command chrt operates on a process. I would like to change the settings system-wide. Any idea about that?


To be more specific, I want to launch some commands, e.g. tar with different policies and the problem is that prior to launching the program, I don't know the process ID.

  • 1
    That makes no sense at all. If SCHED_RR works even if all processes have it, so would SCHED_OTHER, but with more overhead. What is it that you want to achieve that way? Commented Apr 9, 2022 at 13:08
  • I want to change the policy for some programs. For example, I want to test "tar" command with different policies. However, prior to running the command, I don't know the PID. What you said make sense. So, I want to know how can I achieve that?
    – mahmood
    Commented Apr 9, 2022 at 13:16
  • Ok, that means you should really edit your question to ask that! (also, different priorities won't do much for tar: it's IO-bound, not scheduling/CPU bound at all. You cannot speed up reading and writing data from storage by checking more often that there's no data to process yet) Commented Apr 9, 2022 at 13:19
  • Yes I know. I am testing some programs, including, zip, wget, matrix multiplication, graphic and so on. I would also like to use perf for measuring energy with different policies, not only the performance.
    – mahmood
    Commented Apr 9, 2022 at 13:26
  • 1
    @mahmood : I edited my answer for a possible more handy but more dangerous way to proceed.
    – MC68020
    Commented Apr 9, 2022 at 16:21

1 Answer 1


chrt can not only change the scheduling priority of a running process (you'll actually need the pid) but also launch a new process following a particular scheduling policy :

   chrt [options] priority command argument ...

   chrt [options] -p [priority] PID


   chrt sets or retrieves the real-time scheduling attributes of an
   existing PID, or runs command with the given attributes.

So if you want to launch tar running SCHED_RR rtprio 10 straight from the beginning, simply

chrt -r 10 tar blahblahraroptions

If, as written in comments, it would make no sense to have all running processes running the same scheduling policy at the same priority level, there is just no way to achieve that.
It is however possible to launch all your users' processes automatically to your desired scheduling policy / priority since this is (per default) inherited by child processes.

1/ fork a bash process scheduled SCHED_FIFO / priority 10 :

$ chrt -f 10 bash

2/ Whatever process launched from now on will be scheduled identically without the need to use chrt.

/proc/2074 $ ps -eHo pid,ppid,tid,class,rtprio,ni,pri,comm
4168  2074  4168 FF      10   -  50         bash
4192  4168  4192 FF      10   -  50           ps

Use with caution and only for your test purposes, and of course do avoid launching fork bombs as well as assigning the highest possible priority !

  • Did you verify your method? Because while tar zcf x.tar.gz file.c works, the command chrt -r 10 tar zcf x.tar.gz file.c returns chrt: failed to set pid 0's policy: Operation not permitted.
    – mahmood
    Commented Apr 9, 2022 at 17:19
  • @mahmood : errr ? Of course I test first what I advise to do. I had launched chrt -f 10 tar cvf BenchMarks.tar BenchMarks succesfully. At least could we both agree that… I verified my method more often than you… appear reading the fucking manuals ;-)
    – MC68020
    Commented Apr 9, 2022 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .