Non Preemptive Priority
Non Preemptive Priority
Scanner;
class Process {
int pid, burstTime, priority, waitingTime, turnAroundTime;
// Output
System.out.println("\nProcess\tBurst\tPriority\tWait\
tTurnaround");
for (Process p : processes) {
System.out.println(p.pid + "\t" + p.burstTime + "\t" +
p.priority + "\t\t" + p.waitingTime + "\t" + p.turnAroundTime);
}
output:
java -cp /tmp/veP5CEogC1/NonPreemptivePriority
Enter number of processes: 7
Enter burst time and priority for process 1: 8 3
Enter burst time and priority for process 2: 2 4
Enter burst time and priority for process 3: 4 4
Enter burst time and priority for process 4: 1 5
Enter burst time and priority for process 5: 6 2
Enter burst time and priority for process 6: 5 6
Enter burst time and priority for process 7: 1 1