jsos
college code for operating system fundamentals in js
git clone https://9o.is/git/jsos.git
commit f4e395ea5ea5a0951ba281dcbaf02f0eba382989 parent e9c43ef362397273cf53d5606b3a7ea2927abb27 Author: Jul <jul@9o.is> Date: Sun, 25 Nov 2012 23:54:34 -0500 FCFS implemented (RR still works). Diffstat:
| M | scripts/os/scheduler.js | | | 10 | +++++----- |
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/os/scheduler.js b/scripts/os/scheduler.js @@ -25,8 +25,7 @@ function scheduler() { this.busyTime++; // if ready queue is not empty, dequeue - if(this.processTerminated()) { - + if(this.processTerminated()) { var p = _KernelReadyQueue.dequeue(); while(p.state == PCB_STATE_TERMINATED) p = _KernelReadyQueue.dequeue(); @@ -35,13 +34,13 @@ function scheduler() { } _CPU.cycle(); - // update current changes in the PCB registry this.running.updateRegisters( _CPU.PC, _CPU.ACC, _CPU.X, _CPU.Y, _CPU.Z); - this.updateQuantumCount(); + if(CPU_STATE_RR.name == CPU_STATE) + this.updateQuantumCount(); } /* @@ -75,7 +74,8 @@ function scheduler() { } /* - * Updates quantum count + * Updates quantum count and does a context switch system + * call if time is over. */ this.updateQuantumCount = function() { if(++this.quantumCount % RR_QUANTUM == 0) {