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 0 to n -1 represented by a 2D integer array processes, where processes[i]=[enqueueTimei, 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[0]=[2,3], it means that process 0 will be available at time 2 and will take 3 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!