'Run processes with priority from shell (not “nice” )

I am looking for the equivalent command to nice, but for setting process priority and selecting the scheduler to use.

I need to be able to type (or include in a script) something like run-with-scheduler batch a-big-long-command, or run-with-scheduler round-robin priority 10 to set the process priority and scheduler.

Everywhere I look there are article with titles “how to set a process priority in Linux” but they all write about niceness. As you may know niceness is not priority, and up until recently there was no way to set priority. However more recently there has been extra schedulers added to the Linux kernel. These other schedulers, allow priority, and have different behaviour.

E.g. the batch scheduler does not switch to often, and has lower priority than all other schedulers. This results in the tasks running faster (less switching), but only if there are no higher priority tasks running.

The kde tool ksysguard (graphical process viewer), has the ability to view and set a processes niceness, scheduler and priority. However, I am looking for the name of the command line tool.

How, on the command-line, do I specify the scheduler and priority of a command?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source