kern

diff src/timer.c @ 56:0be4615594df

finally, runqueues, blocking, waking up, idle loop etc, all seem to work fine on a single user process... Next up: try forking another one :)
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 15 Aug 2011 06:17:58 +0300
parents 88a6c4e192f9
children 437360696883
line diff
     1.1 --- a/src/timer.c	Mon Aug 15 04:03:39 2011 +0300
     1.2 +++ b/src/timer.c	Mon Aug 15 06:17:58 2011 +0300
     1.3 @@ -136,11 +136,10 @@
     1.4  static void intr_handler(int inum)
     1.5  {
     1.6  	int istate;
     1.7 -	struct process *cur_proc;
     1.8  
     1.9  	nticks++;
    1.10  
    1.11 -	printf("TICKS: %d\n", nticks);
    1.12 +	/*printf("TICKS: %d\n", nticks);*/
    1.13  
    1.14  	istate = get_intr_state();
    1.15  	disable_intr();
    1.16 @@ -149,7 +148,7 @@
    1.17  	if(evlist) {
    1.18  		evlist->dt--;
    1.19  
    1.20 -		while(evlist->dt <= 0) {
    1.21 +		while(evlist && evlist->dt <= 0) {
    1.22  			struct timer_event *ev = evlist;
    1.23  			evlist = evlist->next;
    1.24  
    1.25 @@ -160,12 +159,8 @@
    1.26  		}
    1.27  	}
    1.28  
    1.29 -	if((cur_proc = get_current_proc())) {
    1.30 -		/* if the timeslice of this process has expire, call the scheduler */
    1.31 -		if(--cur_proc->ticks_left <= 0) {
    1.32 -			schedule();
    1.33 -		}
    1.34 -	}
    1.35 +	/* call the scheduler to decide if it's time to switch processes */
    1.36 +	schedule();
    1.37  
    1.38  	set_intr_state(istate);
    1.39  }