The default Linux scheduling policy is SCHED_OTHER , which do not have priority choices, and have a nice level to configure inside the policy.
You will need to switch to another scheduling policy using the pthread_setschedparam function (see also man sched_setscheduler )
โNormalโ planning policies: (by sched_setscheduler(2) )
SCHED_OTHER the standard round-robin time-sharing policy; SCHED_BATCH for "batch" style execution of processes; and SCHED_IDLE for running very low priority background jobs.
Real-time Planning Policies:
SCHED_FIFO a first-in, first-out policy; and SCHED_RR a round-robin policy.
In your case, perhaps you can use SCHED_BATCH , as this does not require root privileges.
Warning: misuse of real-time scheduling policies can damage your system. To do this, you need root privileges to perform this kind of operation.
To be sure of the capabilities of your machine, you can use the chrt tool from util-linux .
As an example:
$ chrt -m SCHED_OTHER min/max priority : 0/0 SCHED_FIFO min/max priority : 1/99 SCHED_RR min/max priority : 1/99 SCHED_BATCH min/max priority : 0/0 SCHED_IDLE min/max priority : 0/0
A way to spend less time (which I often use):
alias batchmake='time chrt --batch 0 make --silent'
During a stay with user privileges, this leads to the fact that make is 15% (in my case).
Edit: introduction of nice , SCHED_BATCH , SCHED_IDLE and chrt . For accuracy! :)
levif Sep 07 2018-10-22T00: 00Z
source share