title: Does endless While loop take up CPU resources?
body: <p>From what I understand, you write your Linux Daemon that listens to a request in an endless loop.<br>
  Something like..</p>
  
  <pre><code>int main() {
      while(1) {
          //do something...
      }
  }
  </code></pre>
  
  <p>ref: <a href="http://www.thegeekstuff.com/2012/02/c-daemon-process/" rel="noreferrer">http://www.thegeekstuff.com/2012/02/c-daemon-process/</a></p>
  
  <p>I read that sleeping a program makes it go into waiting mode so it doesn't eat up resources.  </p>
  
  <p>1.If I want my daemon to check for a request every 1 second, would the following be resource consuming?</p>
  
  <pre><code>int main() {
      while(1) {
          if (request) {
              //do something...
          }
          sleep(1)
      }
  }
  </code></pre>
  
  <p>2.If I were to remove the sleep, does it mean the CPU consumption will go up 100%?</p>
  
  <p>3.Is it possible to run an endless loop without eating resources? Say..if it does nothing but just loops itself. Or just sleep(1).</p>
  
  <p>Endless loops and CPU resources is a mystery to me.</p>