I have a solaris server that needs to run a timecritical application as fast as possible, although setting it to the RT priority class doesnt seem like a good idea since it may need 100 CPU for prolonged periods.

I would like to use the idle cpu time to work on another processs, but this process should not recieve any cpu time at all if the timecritical one has something to do. How can I achieve this, using nice -19 does not allocate 100% cpu to the time critical one.

2 Answers 2


Run your second application under the fixed priority class and with it the lowest possible priority. If it is already running, you can set it using its pid:

priocntl -c FX -m 0 -p 0 -s -i pid <pid>

Or do it at launch time:

priocntl -c FX -m 0 -p 0 -e command [arguments ...]


Note that the FX scheduling class shouldn't be confused with the RT one. While the RT (Real Time) priority class is also a fixed priority class, the processes being granted a RT priority will preempt system threads (i.e. the kernel) so should only be used with processes with relatively short compute activity periods. The RT class is absolutely not recommended for a process requiring 100 CPU threads for an extended period of time like the one you describe. This issue does not exist with the FX class which (default) range of priorities is the same as the regular time sharing ones.

As Yedric noted in his reply, setting the low priority process priority to 0 is not enough to make sure it won't run at all when the high priority one is active.

The reason is the latter being in the time sharing class, the scheduler will notice a process has been waiting for a while so will reduce the actual priority of the critical process down to 0, allowing small bursts of activity from the low priority process.

To avoid this situation, you can set the critical process to the FX class with a median priority. In such case, it will never yield to the other one:

priocntl -c FX -m 30 -p 30 -c critical_command ...  

It is not possible within the Solaris scheduling design to give the hard limits that you are looking for. The closest options are either:

  1. RT for the critical process; or,
  2. Terminating the non-critical process when the critical process needs the CPU and restarting once that need is satisfied; or,
  3. Using process signals SIGSTOP/SIGCONT to put the non-critical process to sleep and allow it to continue.

The answer @jlliagre provided will get you closer than the standard scheduling model defaults would, but it still does not prevent the non-critical process from getting CPU time.

If you have more CPUs/cores than the critical process has threads, then RT will meet your needs easily. Otherwise, unless you do not need to use the system in any other way, RT may not be a good idea. You can easily end up in a situation where you cannot even login due to the critical process not leaving any CPU for it.

  • just thinking, would it make any difference if I made the time critical process fixed priority as well so its process priority never drops to 0? and the other process as per the other answer. It would be bad if it pre empted system threads in this case.
    – camelccc
    Dec 17, 2014 at 21:56
  • It will definitely make a difference, see my updated reply.
    – jlliagre
    Dec 18, 2014 at 0:39

You must log in to answer this question.

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