Subject: Re: Constraining process CPU %time
To: Olaf Seibert <rhialto@polderland.nl>
From: David Maxwell <david@vex.net>
List: tech-kern
Date: 11/07/2000 12:56:10
On Mon, Nov 06, 2000 at 09:19:04PM +0100, Olaf Seibert wrote:
> On Tue 31 Oct 2000 at 22:12:43 -0500, David Maxwell wrote:
> > Is there any way to specify that a process should receive no more than
> > x% (say x==25) of available CPU time? He would like to use a limitation
> > of this sort in order to perform some clustering performance tests.
>
> A very, very crude way to accomplish this would to run three do-nothing
> cpu eaters alongside the process to be limited (at the same priority).
I suggested this at the booth, and it was not an acceptable solution due
to other factors (such as wanting to be able to run multiple tests
simultaneously).
From some 4.4BSD book reading, and some source browsing, it looks like it
wouldn't be too hard to use the semantics of the SSTOP status, and add
a p_flag similar to P_TRACED - something along the lines of P_CPULIM
perhaps. Then add a check in mi_switch to see if a process has gone over
limit, and SSTOP it.
A corresponding conditional would be needed in schedcpu to bring the
process back to SRUN when it has fulfilled its required delay.
Anyway, I'll tell him there's nothing there to do it now, but it seems
like ~20 lines of code would be needed.
--
David Maxwell, david@vex.net|david@maxwell.net -->
If you don't spend energy getting what you want,
You'll have to spend it dealing with what you get.
- Unknown