Re: [PATCH *] scheduler bigpatch 2.1.131-2

Pavel Machek (pavel@bug.ucw.cz)
Tue, 8 Dec 1998 21:39:31 +0100


Hi!

> I just released a new version of the scheduler bigpatch which
> features two changes:
>
> - don't recalculate priority when we were off of the runqueue
> for just one jiffie (3 on Alpha). This is done because
> often-sleeping but still CPU-hungry processes got a bit too
> much CPU time and you've missed pay time anyway when you
> just slept over a jiffie increment
> We now should be a bit fairer (read harsher) agaist those
> 10%-30% CPU using processes

You may want to look at this process: Unfortunately very similar
programs exists in Real Life (kde programs _poll_ for input). I want
them be shown as cpu eaters in statistics (I even had patch for this
some time ago). Are you interested?
Pavel

/*
* This is simple program which should show weak spots in linux's scheduler
*/

#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
#include <unistd.h>

int startgame;

int
ticks( void )
{
struct timeb tb;
int sec, msec;
ftime( &tb );
sec = tb.time - startgame;
msec = tb.millitm;
return sec * 1000 + msec;
}

void
main( int argc, char *argv[] )
{
int delta, badboy = 0, count = 1000000;

startgame = time(NULL);
if (argc>1) {
int t1, t2;
badboy = 1;
printf( "I'm a *BAD* boy! " );
usleep( 1 );
startgame = ticks();
t1 = ticks();
usleep( 1 );
t2 = ticks();
delta = t2-t1;
delta = 20;
printf( "And bad boys know that jiffie is %dmsec\n", delta );
}
else { printf( "I'm a good boy.\n" ); delta = 20; }
while(1) {
if (ticks() % delta > ((delta * 17)/20))
if (badboy)
usleep(1);
if (!((--count)%100000)) { printf( "." ); fflush( stdout ); }
if (!count) break;
}
}

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/