title: what is difference between "sleep" and "wait"
body: <p>what is difference between <code>while(true) {sleep(1);}</code> and <code>while(true) {$queue.wait();}</code>? which one will take the CPU cost?</p>
  
  <p>i think the <code>sleep</code> execute will use CPU to calculate and compare the conditions; 
  at the other side, <code>wait</code> is a blocking call, will not use CPU until something <code>notify</code> to wait it up</p>
  
  <p>am i understood wrong? and how to implement <code>wait</code> in lower level? with <code>sleep</code> or other?</p>
  
  <pre><code>// example(in PHP):
  while (true) {
      // do something 
      // until some conditions become true
      sleep(1);
  }
  
  while (true) {
      $data=$sock.accept(); // block until data response
      // $queue.wait(); // also block until data enqueue
      // do something
  }
  </code></pre>