title: Why does "while(true)" with "Thread.sleep" cause 100% CPU usage?
body: <p><strong>update:</strong> I don't know why but it suddenly turn out to be fine. Now that the program's cpu usage is just 10%~17%.</p>
  
  <hr>
  
  <p>I'm making a linux background problem in java.<br>
  The problem should execute every 100 seconds.<br>
  So I make a timer class and some code like below:</p>
  
  <pre><code>while(true) {   
    try {
      Thread.sleep(1000 * 100);
    } catch (InterruptedException e) {
       e.printStackTrace();
    }           
  }
  </code></pre>
  
  <p>But it still fills up the cpu usage.</p>
  
  <p>That's the whole main(). No other program are running.</p>
  
  <pre><code>public static void main(String[] args) throws WeiboException, HttpException, IOException{
    timer = new Timer(true);
    timer.schedule(new Getdatatimer(), 0, 100 * 1000);
  
    System.out.print("runnning \n");  
    while(true) {
      try {
        Thread.sleep(1000 * 100);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }             
    }
  }
  </code></pre>
  
  <p>the timer accurately run every 100sec. But the question is cpu usage. </p>