[K12OSN] GNUChess

Martin Woolley sysadmin at handsworth.bham.sch.uk
Thu Apr 14 09:35:18 UTC 2005


On Thursday 14 April 2005 03:15, Sudev Barar wrote:
> On Wed, 2005-04-13 at 20:24 +0200, M.Pribik wrote:
> > I have the same experience with cca 100% utilisation of CPU by GNUchess.
> > I have 3GHz hyperthreading P4.
> > CPU1 and CPU2 cyclicly alternates between cca. zero and cca. 100%.
> > Marian.
>
> [SNIP]
>
> See my message sometimes last summers. The only way to protect your LTSP
> setup is to remove the program as by default it sucks up as much
> resources as available to do its computation. Alternatively you have to
> run it with higher nice level. Maybe some guru can point HOWTO.

On our system, the kde menus run the command xboard.  The binary for gnuchess 
is /usr/bin/xboard.  I wrote the following wrapper /usr/local/bin/xboard 
which informs the user that they can only play chess after school and when 
they do so, the command is executed at the lowest priority.  Even at the 
lowest priority it still hogs the cpu, but we don't care after hours.  You 
must have the Perl/TK libraries installed for this script to work.

-- cut here --

#!/usr/bin/perl
#-----------------------------------------------------------------------#
# @(#) xboard v1.00 - 14/01/05 (c) 2005 Handsworth Grammar School       #
# Author: Martin Woolley (Handsworth Grammar School)                    #
# Written: 14/01/05                                                     #
# Reason: This is a wrapper for /usr/bin/xboard (gnuchess).             #
#         gnuchess is a cpu hog and while we could just remove it, we   #
#         are not completly heartless, so we will allow them to run     #
#         the program after 15:00 hours.                                #
#-----------------------------------------------------------------------#

use Tk;

($SEC,$MIN,$HOUR,$DAY,$MONTH,$YEAR,$WEEKDAY,$DAYOFYEAR,$DST)=localtime(time);
if ($HOUR < 15) {

my $mw = MainWindow->new;
$mw->title("Handsworth Grammar School");

$message = "You may only play chess after 3:00pm. We apologise for any 
inconvienience caused." ;
$mw->Message(-text => $message)->pack;

$mw->Button(-text => "OK", -command =>
 sub { $mw->destroy() } )
 ->pack(-side=>'left', -expand=> 1, -fill => 'x');

MainLoop;

}
else {
$CMD="/bin/nice -n 19 /usr/bin/xboard";
$RC=exec($CMD);
}

exit 0;
-- end cut --
-- 
Regards
Martin Woolley
ICT Support
Handsworth Grammar School
Isis Astarte Diana Hecate Demeter Kali Inanna


*************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity 
to whom they are addressed. If you have received this email 
in error please notify postmaster at bgfl.org

The views expressed within this email are those of the 
individual, and not necessarily those of the organisation
*************************************************************




More information about the K12OSN mailing list