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:
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:
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.
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
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
}
}
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