title: Some confusion about nodejs threads
body: <p>I have some confusions about <code>nodejs</code> thread.</p>
  
  <p>As far as I know, <code>nodejs</code> is running in a single thread. If there is a async function is invoked, <code>nodejs</code> will create a new thread to run these async code. After the async code finished. <code>event loop</code> will get async result and trigger the callback function in another new thread.</p>
  
  <p>In order to test, I conducted the following code test：</p>
  
  <pre><code>var fs = require("fs");
  
  fs.readFile('package.json','utf-8', function (err, data) {
      if(err)
          console.log(err)
      else
          console.log(data);
  });
  
  console.log("before loop");
  while(true);
  console.log("after loop");
  </code></pre>
  
  <p>my <strong>expected</strong> result is :  </p>
  
  <blockquote>
    <p>before loop<br>
    -<em>- package.json content -</em>-</p>
  </blockquote>
  
  <p><strong>Actually</strong> get:</p>
  
  <blockquote>
    <p>before loop </p>
  </blockquote>
  
  <p>I may be wrong in some places.</p>
  
  <p><strong>Question</strong>:</p>
  
  <ol>
  <li>why <code>while(true)</code> blocked the <code>readFile()</code> or blocked it`s callback function?  </li>
  <li>what is the relationship between these threads?</li>
  </ol>