-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.java
More file actions
73 lines (67 loc) · 1.78 KB
/
Process.java
File metadata and controls
73 lines (67 loc) · 1.78 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
67
68
69
70
71
72
73
import java.util.*;
public class Process
{
static int glob_pid=0;
int pid;
int tableIndex;
int state;
int current_exec;
int curr_mem;
LinkedList<RunSpec> specifications;
public Process(InputEntry entry)
{
pid=Process.glob_pid++;
state=-2;
current_exec=0;
specifications = entry.reqs;
}
int checkforIO()
{
current_exec=0;
if (specifications.size()==0)
{
MemQueue.updateCurrentFreeMem(curr_mem, 1);
state=-1;
return -1;
}
else if (specifications.getFirst().type==1)
{
System.out.println("Adding " + pid + " to an IOQueue");
IOQueues.addNewProc(this);
return 0;
}
else
return 1;
}
void printDetails()
{
System.out.println("-----------------------------------------------------------");
System.out.println("PID - " + pid + " index " + tableIndex + " state " + state);
System.out.println("Specifications");
for(RunSpec i: specifications)
{
System.out.println(i.type + " - " + i);
}
System.out.println("curr_exec " + current_exec + " curr_mem " + curr_mem);
System.out.println("-----------------------------------------------------------");
}
void printDetailsforProcTable()
{
CpuSpec current_cpu_spec;
IOSpec current_io_spec;
PsLogger.printMethod("");
PsLogger.printMethod("PID - " + pid + " index " + tableIndex + " state " + state);
PsLogger.printMethod("Current Specifications ");
int current_type = specifications.element().type;
if(current_type==0){
current_cpu_spec = (CpuSpec)specifications.element();
System.out.println(current_cpu_spec.toString());
}
else if(current_type==1){
current_io_spec = (IOSpec)specifications.element();
System.out.println(current_io_spec.toString());
}
PsLogger.printMethod("curr_exec " + current_exec + " curr_mem " + curr_mem);
PsLogger.printMethod("");
}
}