-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduler.java
More file actions
27 lines (20 loc) · 867 Bytes
/
Scheduler.java
File metadata and controls
27 lines (20 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.ArrayList;
public abstract class Scheduler {
protected ArrayList<Process> processes; // the list of processes to be executed
public Scheduler() {
this.processes = new ArrayList<Process>();
}
/* the addProcess() method should add a new process to the list of
* processes that are candidates for execution. This will probably
* differ for different schedulers */
public abstract void addProcess(Process p);
/* the removeProcess() method should remove a process from the list
* of processes that are candidates for execution. Common for all
* schedulers. */
public void removeProcess(Process p) {
processes.remove(p);
}
/* the getNextProcess() method should return the process that should
* be executed next by the CPU */
public abstract Process getNextProcess();
}