public void execute() throws IOException {
	
		File outFile = new File("MLFOut.txt");
		FileWriter outWriter = new FileWriter(outFile);
		BufferedWriter outBuff = new BufferedWriter(outWriter);

		outBuff.write("MLF");
		outBuff.newLine();

		while (! this.isDone()) {
			PCB proc = peek();
			outBuff.write("Queue " + indexOf(currQueue) + " selected.");
			outBuff.newLine();
			try {
				proc.giveBurst();
				for (int i=0; i<size(); i++) {
					for (int j=0; j<get(i).size(); j++) {
						PCB nextPCB = get(i).get(j);
						if (nextPCB.getBurstTime() != 0 && !nextPCB.equals(proc)) {
							nextPCB.giveWait();
						}
					}
				}
				//System.out.println(this);											//Uncomment to print the queue after each CPU burst.
			} catch (InterruptedException e) {}
			outBuff.write("Process " + proc.getID() + " receives a CPU burst. " + proc.getBurstTime() + " remaining.");
			outBuff.newLine();
			if (proc.getBurstTime() == 0) {
				totalWaitingTime += proc.waitTime;
				totalTurnaroundTime += proc.turnTime;
				outBuff.write("Process " + proc.getID() + " terminated.");
				outBuff.newLine();
				//System.out.println(this);											//Uncomment to print the queue when a process terminates.
			} else {
				if (proc.burstsRecd == currQueue.quantum) {
					currQueue.currIndex = currQueue.indexOf(proc);					//Added to prevent skipping a process after a demotion.
					demote(proc);
					outBuff.write("Process " + proc.getID() + " demoted.");
					outBuff.newLine();
					//System.out.println(this);										//Uncomment to print the queue when a process is demoted.
				}
			}
		}

		outBuff.close();
		System.out.println("MLF:");
		System.out.println(this);
	}