Question: In this exercise you will simulate the CPU scheduler, a topic you will cover in later courses. The scheduling algorithm that will be used is
In this exercise you will simulate the CPU scheduler, a topic you will cover in later courses. The scheduling algorithm that will be used is Shortest Job First. It works as follows:
You are given n processes labeled from to n represented by a D integer array processes, where processesienqueueTimei executionTimei means that the ith process will be available to execute at enqueueTimei and will take executionTimei to finish processing. For example, if we had processes it means that process will be available at time and will take ticks to process entirely.
The way the CPU works is that it will run for as long as there are processes available to execute. With each "tick" of time we do one of two possible actions: look into the available processes and pick one to do or if no process is available we do nothing, this is called being idle.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
