Annotated Bibliography On Import Java

1518 Words7 Pages
import java.io.*; import java.util.Random; import java.util.Scanner; public class Processor { // Register variables static int IR, AC, X, Y, timer; static int PC = 0; static int SP = 1000; static int instructionCount = 0; static int userStack = 1000; static int systemStack = 2000; // turns to false on interrupts static boolean userMode = true; // avoid nested interrupt execution static boolean interrupt = false; public static void main(String args[]) { String file = null; // check argument length if (args.length == 2) { // checks and sets interrupt timer file = args[0]; timer = Integer.parseInt(args[1]); } else { // throws error for wrong input argument System.out.println("Invalid argument."); System.exit(0); } try { // create child processor and pipe Runtime runTime = Runtime.getRuntime(); Process process = runTime.exec("java Memory"); OutputStream outputStream = process.getOutputStream(); PrintWriter printWriter = new PrintWriter(outputStream); // maps input stream to scanner to read from memory InputStream inputStream = process.getInputStream(); Scanner memoryScanner = new Scanner(inputStream); // function to send file name to memory sendArgumentToMemory(printWriter, inputStream, outputStream, file); while (true) { //checking interrupt timer if (instructionCount > 0 && (instructionCount % timer) == 0 && interrupt == false) { interrupt = true;// if true then

More about Annotated Bibliography On Import Java

Open Document