cpu scheduler simulation Build a system to simulate these processes. First come
ID: 3566636 • Letter: C
Question
cpu scheduler simulation
Build a system to simulate these processes.
First come first serve, shortest job first, shortest job remaining, priority scheduling, round robin, priority rate monotomic and Earliest deadline first.
The information about processes should be read from a file, keep note of pre-emptive and non pre-emptive processes.
The program should then create a report for each process algorithm including
- Throughput
- Average waiting time
- cpu utilization
- turn around time.
Source code should be Java.
Explanation / Answer
import java.applet.*; import java.awt.*; import java.io.*; import java.util.*; import java.lang.*; /* */ public class finalcase extends Applet{ int apw1[]; int p[]; int i=0,n,n1; Graphics g= getGraphics(); public void init(){ try{ BufferedReader obj=new BufferedReader(new InputStreamReader (System.in)); System.out.println("ENTER no. of processes:"); n=Integer.parseInt(obj.readLine()); int ch; int bt[]=new int[n]; do{ System.out.println("MENU FOR CPU SCHEDULING"); System.out.println("1.PRIORITY method (non-preemptive)"); System.out.println("2.PRIORITY method (preemptive)"); System.out.println("3.EXIT"); System.out.println("ENTER YOUR CHOICE"); ch=Integer.parseInt(obj.readLine()); switch(ch){ case 1: //Non-Preemptive Priority { for( i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.