next up previous
Next: Chaves e Camas Up: Multiplexação do Processador Previous: 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 Sergio F. de Carvalho
Wed Mar 19 14:56:39 EST 1997