plan 9 kernel history: overview | file list | diff list

2003/0314/port/proc.c (diff list | history)

2003/0301/sys/src/9/port/proc.c:259,2642003/0314/sys/src/9/port/proc.c:259,279 (short | long | prev | next)
Add yield.
rsc Mon Mar 20 20:49:43 2006
1990/0227    
	splx(s); 
} 
 
2003/0314    
/* 
 *  yield the processor to any other runnable process 
 */ 
void 
yield(void) 
{ 
	if(anyready()){ 
		up->yield = 1; 
		sched(); 
	} 
} 
 
/* 
 *  pick a process to run 
 */ 
1990/0227    
Proc* 
runproc(void) 
{ 
2003/0301/sys/src/9/port/proc.c:282,2942003/0314/sys/src/9/port/proc.c:297,311
2003/0228    
	for(i = 0;; i++){ 
		/* 
2003/0301    
		 *  find the highest priority target process that this 
2003/0228    
		 *  processor can run given affinity constraints 
2003/0314    
		 *  processor can run given affinity constraints. 
		 * 
2003/0228    
		 */ 
		for(rq = &runq[Nrq-1]; rq >= runq; rq--){ 
2003/0301    
			tp = rq->head; 
			if(tp == 0) 
2003/0228    
				continue; 
2003/0301    
			for(; tp; tp = tp->rnext){ 
2003/0314    
			for(tp = rq->head; tp; tp = tp->rnext){ 
				if(tp->yield){ 
					tp->yield = 0; 
					continue; 
				}	 
2003/0301    
				if(tp->mp == nil || tp->mp == MACHP(m->machno) 
				|| (!tp->wired && i > 0)) 
2003/0228    
					goto found; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)