title: Multi-threaded compiler returning different outputs upon fastly repeated executions
body: <p>I have a multi-threaded compiler developed in Java. It receives n filepaths and starts one thread for each filepath received. </p>
  
  <p>Everything works fine if I do multiple executions with a single file. However, when I input multiple files and execute it one time per second it shows different parsing outputs in the source-code loaded.</p>
  
  <p>It was implemented using the recursive descent parser technique. The function that calls the threads is shown as follows:</p>
  
  <pre><code>public static void main(String[] args) {
  
      if(args.length == 0){
          System.out.println("No file path informed. Please inform file paths.");
          System.out.println("Usage: java -jar KPiler.jar file1.txt file2.txt");
      }
  
      List&lt;String&gt; paths = new ArrayList&lt;&gt;();
      List&lt;String&gt; errorMessages = new ArrayList&lt;&gt;();
      List&lt;Parser&gt; compileJobs = new ArrayList&lt;&gt;();
  
      paths.addAll(Arrays.asList(args));
  
  
      while(paths.size() &gt; 0 || compileJobs.size() &gt; 0){
  
          if(compileJobs.size() &lt; MAX_JOBS &amp;&amp; paths.size() &gt; 0){
              compileJobs.add(new Parser(paths.remove(0)));
              compileJobs.get(compileJobs.size() -1).start();
          }
  
          for(int i=0 ; i&lt;compileJobs.size(); i++){
              if(!compileJobs.get(i).isAlive()){
                  errorMessages.add(compileJobs.get(i).getErrorMessages());
                  compileJobs.remove(i);
              }
          }
      }
      //PRINTING OUTPUT
      for(int i = 0; i&lt;errorMessages.size(); i++){
          System.out.println(errorMessages.get(i));
  
      }
  
  }
  </code></pre>
  
  <p>Does it have to do with multiple file accesses?</p>