kern

diff src/timer.c @ 57:437360696883

I think we're done for now. two processes seem to be scheduled and switched just fine, fork seems to work (NO CoW YET!)
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 16 Aug 2011 03:26:53 +0300
parents 0be4615594df
children f44bec97a0ec
line diff
     1.1 --- a/src/timer.c	Mon Aug 15 06:17:58 2011 +0300
     1.2 +++ b/src/timer.c	Tue Aug 16 03:26:53 2011 +0300
     1.3 @@ -136,6 +136,7 @@
     1.4  static void intr_handler(int inum)
     1.5  {
     1.6  	int istate;
     1.7 +	struct process *p;
     1.8  
     1.9  	nticks++;
    1.10  
    1.11 @@ -159,7 +160,12 @@
    1.12  		}
    1.13  	}
    1.14  
    1.15 -	/* call the scheduler to decide if it's time to switch processes */
    1.16 +	/* decrement the process' ticks_left and call the scheduler to decide if
    1.17 +	 * it's time to switch processes
    1.18 +	 */
    1.19 +	if((p = get_current_proc())) {
    1.20 +		p->ticks_left--;
    1.21 +	}
    1.22  	schedule();
    1.23  
    1.24  	set_intr_state(istate);