A Nice routine

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

A Nice routine

Post by sje » Tue May 12, 2015 2:33 pm

A Nice routine

If you are using your computer for running your chess program and at the same time for browsing TalkChess, you might want to have your chess program running at a lower priority. You can do this manually with the renice command, or you can build the same functionality into your program. The routine is:

Code: Select all

void Nice(void)
{
  const int rc = setpriority(PRIO_PROCESS, 0, 20);
  
  if (rc != 0)
    Die("Nice", "Bad setpriority");
}
For details: http://www.unix.com/man-page/Linux/2/setpriority/

User avatar
hgm
Posts: 24655
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: A Nice routine

Post by hgm » Tue May 12, 2015 2:37 pm

Of course you can also instruct the GUI to run the engines at lower priority. E.g. with XBoard using the option -niceEngines N.

User avatar
pocopito
Posts: 238
Joined: Tue Jul 12, 2011 11:31 am
Contact:

Re: A Nice routine

Post by pocopito » Tue May 12, 2015 7:23 pm

Maybe cpulimit is worth bearing in mind too:

http://freecode.com/projects/cpulimit
Two first meanings of the dutch word "leren":
1. leren [vc] (learn, larn, acquire) acquire or gain knowledge or skills.
2. leren [v] (teach, learn, instruct) impart skills or knowledge to.

syzygy
Posts: 4600
Joined: Tue Feb 28, 2012 10:56 pm

Re: A Nice routine

Post by syzygy » Tue May 12, 2015 7:49 pm

Let's open a thread for each posix function.

Dann Corbit
Posts: 11238
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: A Nice routine

Post by Dann Corbit » Tue May 12, 2015 7:52 pm

hgm wrote:Of course you can also instruct the GUI to run the engines at lower priority. E.g. with XBoard using the option -niceEngines N.
That is a much better way of doing it. Arena has this feature also.

Post Reply