@Override
	public void run() {
		Random random = new Random();
		while(true) {
			int delayPeriod = random.nextInt((max - min) + 1) + min;
			try {
				Thread.sleep(Long.valueOf(delayPeriod));
			} catch (InterruptedException e) {
				System.out.println("IODevices thread interrupted! This is not supposed to happen.");
				e.printStackTrace();
			}
			
			if(debugFlag == true) {
				System.out.println("IODevice " + deviceType + " generated an interrupt. Delay time = " 
						+ delayPeriod + " milliseconds.");
			}
			
			try {
				ProcessControlBlock target = waitingProcesses.remove();
				if(debugFlag == true) {
					System.out.println("IODevice " + deviceType + " interrupt targeted process PID " + 
							target.getPid() + ", state = " + target.getState() + ", priority = " 
							+ target.getPriority());
				}
				currentCPU.IOinterupt(target);
			} catch (NoSuchElementException e) {
				if(debugFlag == true) {
					System.out.println("No processes currently waiting for IODevice " + deviceType);
				}
			}
		}
	}