\documentclass{article}

% Use the Cactus ThornGuide style file
% (Automatically used from Cactus distribution, if you have a 
%  thorn without the Cactus Flesh download this from the Cactus
%  homepage at www.cactuscode.org)
\usepackage{../../../../../doc/latex/cactus}

\newlength{\tableWidth} \newlength{\maxVarWidth} \newlength{\paraWidth} \newlength{\descWidth} \begin{document}

\title{Nice}
\author{Frank L\"offler (knarf@cct.lsu.edu)}

\maketitle

% Do not delete next line
% START CACTUS THORNGUIDE

\begin{abstract}
Simple tool for using a (configurable) nice level for all processes.
\end{abstract}

\section{Comments}

This thorn tries to renice all processes of Cactus to a given nice level.\\
To renice a process means to change its nice level after the start. The nice
level is a way to control the priority of processes for cpu power. It is
always a good idea to give cpu-intensive jobs (like Cactus runs) a low
priority if you are using desktop machines, especially if other people are
using them too.

The nice level has a range of $-20$ to $19$. A higher number means less
priority. Mostly, normal processes will get $0$ and only the superuser
(root) can use negative values. Also only root can lower the nice level
of a process, so if you nice your Cactus Run to 19, you cannot renice it
later to an lower nice-level. The nice level of single
processes can be controled by the system commands $nice$ and/or $renice$.
In the case of Cactus and Lamd this is not possible at startup. Therefore
this thorn will set the nice level of your processes at CCTK\_PARAMCHECK
(in the beginning of the calculation).\\
This thorn has only one parameter:
\begin{verbatim}
  CCTK_INT Nice_nice
\end{verbatim}
which is by default 19.\\*[1cm]
Note to developers:\\
This thorn uses $getpriority()$ and $setpriority()$ and therefore needs
the includes $<$sys/time.h$>$, $<$errno.h$>$ and $<$sys/resource.h$>$.
If these are not provided on some platform, please tell me.
% Do not delete next line
% END CACTUS THORNGUIDE



\section{Parameters} 


\parskip = 0pt

\setlength{\tableWidth}{160mm}

\setlength{\paraWidth}{\tableWidth}
\setlength{\descWidth}{\tableWidth}
\settowidth{\maxVarWidth}{nice\_nice}

\addtolength{\paraWidth}{-\maxVarWidth}
\addtolength{\paraWidth}{-\columnsep}
\addtolength{\paraWidth}{-\columnsep}
\addtolength{\paraWidth}{-\columnsep}

\addtolength{\descWidth}{-\columnsep}
\addtolength{\descWidth}{-\columnsep}
\addtolength{\descWidth}{-\columnsep}
\noindent \begin{tabular*}{\tableWidth}{|c|l@{\extracolsep{\fill}}r|}
\hline
\multicolumn{1}{|p{\maxVarWidth}}{nice\_nice} & {\bf Scope:} private & INT \\\hline
\multicolumn{3}{|p{\descWidth}|}{{\bf Description:}   {\em Nice level}} \\
\hline{\bf Range} & &  {\bf Default:} 19 \\\multicolumn{1}{|p{\maxVarWidth}|}{\centering -20:19} & \multicolumn{2}{p{\paraWidth}|}{The range for the nice is from -20 to 19, but only root can use negative values, default is 19.} \\\hline
\end{tabular*}

\vspace{0.5cm}\parskip = 10pt 

\section{Interfaces} 


\parskip = 0pt

\vspace{3mm} \subsection*{General}

\noindent {\bf Implements}: 

nice
\vspace{2mm}

\vspace{5mm}\parskip = 10pt 

\section{Schedule} 


\parskip = 0pt


\noindent This section lists all the variables which are assigned storage by thorn CactusUtils/Nice.  Storage can either last for the duration of the run ({\bf Always} means that if this thorn is activated storage will be assigned, {\bf Conditional} means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.


\subsection*{Storage}NONE
\subsection*{Scheduled Functions}
\vspace{5mm}

\noindent {\bf CCTK\_STARTUP} 

\hspace{5mm} nice\_renice 

\hspace{5mm}{\it renice the process } 


\hspace{5mm}

 \begin{tabular*}{160mm}{cll} 
~ & Language:  & c \\ 
~ & Type:  & function \\ 
\end{tabular*} 



\vspace{5mm}\parskip = 10pt 
\end{document}
