Question
Instructions: (1) implement Round Robin Scheduling (2) Implement Multi-level feedback queue (3) For each, show cpu utilization when all processes are finished(4) For each, show
Instructions: (1) implement Round Robin Scheduling (2) Implement Multi-level feedback queue (3) For each, show cpu utilization when all processes are finished(4) For each, show average wait time when all processes are finished
the answer like this program i want it in java package scheduler; public abstract class Scheduler implements Iterable { protected int contextSwitchTime; //how long a context switch takes. protected int clock; //the number of cycles since the system was "started" (the current time). public Scheduler(int contextSwitchTime) { this.contextSwitchTime = contextSwitchTime; clock = 0; } public abstract void add(ProcessControlBlock pcb); public abstract ProcessControlBlock next(); public abstract boolean isEmpty(); public abstract void execute(ProcessControlBlock pcb); public void execute() { System.out.println("Executing Processes"); while(!isEmpty() && clock < 100) { updateProcessControlBlocks(); System.out.println("---------Current Processes----------(CLOCK: " + clock + ")"); for(ProcessControlBlock pcb : this) { System.out.println(pcb); } ProcessControlBlock pcb = next(); clock += contextSwitchTime; //a context switch is happening... if(pcb == null) { tick(); continue; } System.out.println(pcb + "@" + clock); execute(pcb); add(pcb); } } public void tick() { clock++; } public void tick(int time) { clock += time; } public void updateProcessControlBlocks() { //System.out.println("Updating Processes (CLOCK: " + clock + ")"); for(ProcessControlBlock pcb : this) { pcb.update(clock); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started