title: code for optimized watch
body: <p>i want to implement a code to keep a watch on suppose some event ...at the meantime i don have any inbuilt eventwatcher so i hv to implement one of mine..which consumes least cpu &amp; memory.</p>
  
  <p>can u suggest me one..</p>
  
  <p>for example a pseudocode is given:</p>
  
  <pre><code>while(true)
  {
      if(process.isrunning)
          process.kill();
  }
  </code></pre>