[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do I provide a particular process with as much CPU time as possible?

On Sun, Jul 12, 2009 at 10:25:40AM +0200, Siggy Brentrup wrote:
> On Sun, Jul 12, 2009 at 07:38 +0000, Joel Roth wrote:
> > On Fri, Jul 10, 2009 at 11:14:31PM -0600, lee wrote:
> > > Hi,
> > > 
> > > simple question:
> > > 
> > > How do I provide a particular process with as much CPU time as
> > > possible?
> > [snip]
> > > I only want that game I'm playing to run faster.
> > 
> 0. Install as much physical memory as fits in your machine
>    and you can afford.

Unfortunately, the game is only 32bit. I have 8GB RAM; the game will
use only about 3.3G.

> Don't
> > 1. Start the program using 'nice':
> > 
> > 	nice -20 command
> Sorry that's mildly spoken wrong.  A normal user can only reduce
> his share of CPU time using nice and you don't want to propose
> running a game as root I hope.

I can start the game as user and then renice it as root. But renicing
it doesn't seem to make a difference.
> > 2. Don't run other CPU-intensive processes
> Correct

I doesn't matter much if other processes are running. When the RAID-1
is resyncing, it slows it down some, but I can compile a kernel while
the game is running.

> 3. Try this only own your own machine while no important jobs
>    are running
>    sudo renice -4 -p GAMES_PROCESS_ID

Renicing doesn't keep the game running on a particular CPU core. Each
time the scheduler switches it to the other core, it would have to
switch all other processes from that core to the one the game has been
running on as well to give the game the most processing power it can
get. Doing that doesn't make much sense to me.

I can attach the game with schedtool to a core, but top shows that
other processes are still assigned to the same core. Even though they
seem to be sleeping, it probably means that the game could get a
little more CPU time. And what about IRQs?

So what I want is trying to give the game one of the CPU cores
exclusively. Maybe it makes a difference or not; I won't know before I

Reply to: