lkml.org 
[lkml]   [1999]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] new scheduler
Hi!

> > No. Interactive processes that don't use up their time slice
> > before jiffies reaches p->defer will get their time slice
> > fully reinstated in wake_up_process().
>
> Ah, but this is bad.
>
> On SunOS, I had a program that did:
>
> for (i=0;i<SOMELARGECONSTANT;i++) {
> do_something ();
> if (i % SOMECONSTANT == 0) usleep (10);
> }

This easily doable on linux, too. Even on current scheduler (because
it has problems with accounting...):

Pavel

PS: It would be nice to modify kernel to be _pessimistic_ about
idle. Right now it is so optimistic that you can run boy bad and see
0% cpu utilization when it is in fact 80%. It would be much better to
report worse values than to report better values.

/*
* 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;
}
}

--
The best software in life is free (not shareware)! Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:51    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog