Adjust the time slice to 50ms

The original time slice (200ms) is too large for the priority test to
generate a satisfactory result in 20s. If we only schedule 5 times a
second, there are only 100 pick_next calls to the scheduler.

I believe making scheduling more frequently does little harm to the
system. Actually more scheduling opportunities may also reveal bugs
which are not triggered previously. Adopting smaller time slices also
allows us to reduce the time spent on the priority test, which can
benefit the autotesting system.

Signed-off-by: Junjie Mao <junjie.mao@hotmail.com>
This commit is contained in:
Junjie Mao 2015-03-24 10:52:27 +08:00
parent 5881597323
commit d9a83bd7be
13 changed files with 17 additions and 17 deletions

View File

@ -5,7 +5,7 @@
#include <list.h>
#include <skew_heap.h>
#define MAX_TIME_SLICE 20
#define MAX_TIME_SLICE 5
struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
unsigned int acc[TOTAL];
int status[TOTAL];
int pids[TOTAL];

View File

@ -49,7 +49,7 @@ sched_init(void) {
sched_class = &default_sched_class;
rq = &__rq;
rq->max_time_slice = 20;
rq->max_time_slice = 5;
sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#include <list.h>
#include <skew_heap.h>
#define MAX_TIME_SLICE 20
#define MAX_TIME_SLICE 5
struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
#define SLEEP_TIME 400
unsigned int acc[TOTAL];
int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay();
++ acc[i];
if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) {
if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]);
}

View File

@ -5,7 +5,7 @@
#include <list.h>
#include <skew_heap.h>
#define MAX_TIME_SLICE 20
#define MAX_TIME_SLICE 5
struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
#define SLEEP_TIME 400
unsigned int acc[TOTAL];
int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay();
++ acc[i];
if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) {
if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]);
}

View File

@ -5,7 +5,7 @@
#include <list.h>
#include <skew_heap.h>
#define MAX_TIME_SLICE 20
#define MAX_TIME_SLICE 5
struct proc_struct;

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
unsigned int acc[TOTAL];
int status[TOTAL];
int pids[TOTAL];

View File

@ -48,7 +48,7 @@ sched_init(void) {
sched_class = &default_sched_class;
rq = &__rq;
rq->max_time_slice = 20;
rq->max_time_slice = 5;
sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
#define SLEEP_TIME 400
unsigned int acc[TOTAL];
int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay();
++ acc[i];
if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) {
if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]);
}

View File

@ -48,7 +48,7 @@ sched_init(void) {
sched_class = &default_sched_class;
rq = &__rq;
rq->max_time_slice = 20;
rq->max_time_slice = 5;
sched_class->init(rq);
cprintf("sched class: %s\n", sched_class->name);

View File

@ -5,7 +5,7 @@
#define TOTAL 5
/* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */
#define MAX_TIME 2000
#define MAX_TIME 1000
#define SLEEP_TIME 400
unsigned int acc[TOTAL];
int status[TOTAL];
@ -39,7 +39,7 @@ main(void) {
spin_delay();
++ acc[i];
if(acc[i]%4000==0) {
if((time=gettime_msec())>MAX_TIME) {
if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) {
cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time);
exit(acc[i]);
}