You (and your team if you decided to work in a team) should use the Java IDE you find appropriate (e.g., NetBeans, Eclipse) to solve this project. You are building a round robin preemptive scheduler to organize the work of processes in a computing system. Any process can be either newly created, ready to be selected by the scheduler, running for a certain amount of time (a.k.a. Quantum), or terminated when done. You may assume that a process will not be waiting/blocked while being in the running state. Your scheduler is composed of the following components:

Process (Component 1):

Create a class that represents a process in a computing system. Any process, in order to work within your scheduler, needs to be described in terms of: 1) Unique identifier (integer value); 2) Arrival time (integer value represents when the process became available in the system); 3) Execution time (integer value represents how long the process should run to finish the task); and 4) Priority (integer value represents the priority of the process with 1 represents the highest priority). The class must have the following mandatory functions:

  • Default constructor: provides a unique ID and initializes the rest of variable by zeros.
  • Full constructor: initializes the four variables by the constructor's data.
  • Get/Set for each variable.
  • toString: return a string with the current values of the process' variables.
  • You can add more functions if required.

Scheduler (Component 2):

Function that accepts an array of processes and quantum (integer value represents the maximum time window for how long each process should run). The scheduler schedules the input processes with respect to their arrival time and considers their unique identifiers whenever they have same arrival time (two processes with same arrival time, then consider the one with smaller id as first choice). The scheduler finally prints the selected processes for running by calling the toString function.

Initializer (Component 3):

As mentioned in the previous component, the scheduler accepts an array of processes as input. Initializer, function, creates such an array of processes dynamically. The initializer reads an input text file that resides on your computer and holds information about the processes you need to create for your system. The file is structured as follows;

Number of processes, quantum time
id, arrival time, executing time, priority
id, arrival time, executing time, priority
.....
id, arrival time, executing time, priority

The first line of the file shows the number of processes you have in the file and the quantum time (the input to the scheduler). The next lines represent information about the different processes.

Take the following as an example for such file - here we have 3 processes and quantum to be 5. Each process (takes a separate line) is represented as id, arrival time, and executing time. For example: first process has id of 1, arrival time of 5, execution time of 8, and priority of 1 (highest priority).

3, 5
1, 5, 8, 1
2, 0, 10, 2
3, 10, 7, 3

Main Engine (Component 4):

The engine is the module that runs the different components you developed sequentially. As your scheduler is just one module of the OS, it should run in parallel with other modules of the OS. The engine works on two threads, thread 1 and thread 2, that run sequentially. Thread 1 runs the initializer, and Thread 2 waits until thread 1 is done then runs the scheduler directly after

public class MainEngine {
// array of processes, initially empty
// quantum value, initially zero
public static void Initializer(...) {
}

public static void Scheduler(...) {
}

public static void main(String[] args) {
Thread 1: run the Initializer
Thread 2: run the scheduler
}
}

Test Cases:

0.

4, 3
0, 0, 5, 1
1, 0, 3, 2
2, 0, 8, 4
3, 0, 6, 3

1.

3, 4
1, 0, 24, 2
2, 0, 3, 3
3, 0, 3, 1

2.

4, 2
1, 0, 7, 1
2, 2, 4, 3
3, 3, 2, 4
4, 9, 1, 2
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.