-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
66 lines (60 loc) · 2.06 KB
/
Main.java
File metadata and controls
66 lines (60 loc) · 2.06 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.io.File;
public class Main
{
public static void main(String args[])
{
boolean debug=true;
File sysconfigfile = new File("Z:\\OS assignment progs\\Assignment 2\\Sample inputs\\simulator_config");
File jobfile = new File ("Z:\\OS assignment progs\\Assignment 2\\Sample inputs\\sample1\\test1.job");
String Modelfilepath = ("/Z:\\OS assignment progs\\Assignment 2\\Sample inputs\\sample1\\");
/* Call
ConfigInput
ReadJobs
ReadModelFiles */
if (debug)
{
System.out.println("Starts here...");
System.out.println("---------------------------------");
}
//ConfigInput newconf = new ConfigInput();
ConfigInput.readSysConfig(sysconfigfile);
ReadJobs.readJobFile(jobfile);
if (debug)
System.out.println("---------------------------------");
ReadModelFiles.ReadModels(Modelfilepath);
if (debug)
{
System.out.println("---------------------------------");
System.out.println("max proc = " + SystemConfig.max_proc);
System.out.println("PSG = " + SystemConfig.PSG);
System.out.println("numIO = " + SystemConfig.numIO);
System.out.println("memory = " + SystemConfig.memory);
System.out.println("---------------------------------");
InputTable.display();
}
int current_time=0;
while (SystemConfig.total_jobs_submitted>PCB.numDone)
{
System.out.println("CURRENT TIME - " + current_time);
InputTable.checkfornewprocess(current_time);
Ready.update(SystemConfig.PSG);
IOQueues.update(SystemConfig.PSG);
MemQueue.update();
current_time+=SystemConfig.PSG;
PCB.removeDoneProcesses();
if(OutputTable.getCurrentSize()>0)
{
Integer next_output_time = OutputTable.getNextOutputTime();
if((int)next_output_time<=current_time)
{
System.out.println("Printing Process Table");
PCB.printProcessTable();
OutputTable.removeFirstEntry();
}
}
}
System.out.println("---------------------\nSimulation Complete\n------------------------");
PsLogger.printMethod("----------------\nSimulation Ended\n-----------------------");
PsLogger.printMethod(""+current_time);
}
}