lkml.org 
[lkml]   [2004]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Some ideas about % of CPU for a process
From
Date
On Fri, 12 Nov 2004 19:55:33 +0100, Ed Schouten said:

> On Fri 12 Nov 2004 03:47 PM, Diego wrote:
> > I'm trying to define a % of cpu for a process, but i don?t have idea
> > about how i can do it. For example, i said that my process need 40% of
> > CPU during its lifetime, how can i do it in kernel 2.6?
> > Thanks for ideas.
>
> Why don't you 'ps' the process and divide the running time through the
> starting time?

I think he's trying to make a 40% *allotment* - as in "this number cruncher
is authorized to take 40% of the CPU for the next 6 hours". The devil always
ends up being in the details however - things I've seen scheduling systems
fail with in the past:

1) Process is allowed to take 40% of the CPU, but so overcommits memory that
it can't actually *get* it because 65% of the time, the system is in a page
wait from the swap partition. (iterate across any *other* shared resource
that isn't directly tied to CPU).

2) Process is allowed to take 40% of the CPU, and no more - and somebody gets
torqued off because the system is 60% idle.

3) Process is allowed to take 40% at all times, and more if available - and
somebody gets torqued off because it's slow to notice the system has bogged
down - so it's still getting 60% for another 2-3 minutes when we're loaded
before the scheduler catches up.

4) And you always get the whiner who complains it's getting 39% or 41%. ;)

Saying "40% of the CPU" is easy - the fun is in the corner cases...
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.047 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site