public void MEC2(Process process) throws IOException {
    process.setState("Running");
    int clock = 0;

    // while loop to execute instructions
    while (true) {
      clock++;
      if (isTermenated()) {
        // if the process terminates, then break the method
        process.setState("Terminated");
        if (!IOBoundJob.isExist(process)) CPUBoundJob.enqueue(process, 0);
        Statistic.NUMBER_OF_EXECUTED_PROCESSES++;
        file.writeProcess(process);
        RAM.loadProcessFromHardDisk();
        return;
      }
      if (isInterrupted(process)) {
        // if the process interrupted, then return the process to the Ready Queue (RAM)
        process.setState("Ready");
        process.setRemainingTime(process.getRemainingTime() - clock);
        RAM.returnProcess(process);
        return;
      }
    }
  }