-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
38 lines (32 loc) · 1.07 KB
/
Main.java
File metadata and controls
38 lines (32 loc) · 1.07 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
/*
Title: Main.java
Name: Dylan Kapustka (Dlk190000)
Instructor: Professor Ozbirn
Course: CS 4348.001 - S21
Date: 03/09/2021
Description: This class creates a new CPU object and tells it to start processing.
*/
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
// Check for two arguments expected
if (args.length != 2) {
System.out.println("Error Incorrect Arguments:" + Arrays.toString(args));
System.exit(0);
}
try {
// set up the memory
Process memory = Runtime.getRuntime().exec("java Memory " + args[0]);
InputStream is = memory.getInputStream();
OutputStream os = memory.getOutputStream();
int timer = Integer.parseInt(args[1]); //Set timer to interrupt val
String file = args[0]; // Store file name for ease of access later
//Create our CPU
CPU cpu = new CPU(is, os, timer, file);
cpu.startCPU();
} catch (Exception e) {
e.printStackTrace();
}
}
}