- - - - CENAPAD-MGCO

contents index A seguir: Chaves e Camas Acima: Multiplexação do Processador Anterior: Criação de processos e


Escalonamento e fim dos processos

  
void schedule() {  
   disableInterrupts(); 
   while(nrofActiveProcesses > 0) {  
      currentProcess = ready.get();  
      /* escolhe o proximo processo */ 
      iotransfer(kernelCoroutine, 
      currentProcess.coroutine, clockInterruptVector);  
      if(currentProcess.state == READY) 
         ready.put(currentProcess); 
   }   
   transfer(kernelCoroutine, fatherCoroutine); 
}  
 
void processEnd() {  
   disableInterrupts(); 
   nrofActiveProcesses--; 
   currentProcess.state = FINISHED;  
   transfer(currentProcess.coroutine, kernel);  
}



Osvaldo Carvalho - Postscript - Comentários?