title: How to track open instances of an application in C#
body: <p>I want to insure mutual exclusion in my project for installing updates.<br>
  The project is multi-instance means one can open a instances without closing the other open instances. There is a function called <code>installUpdates()</code> which installs the available updates. Since several instances are there so only one of them need to install the updates. I want to insure that only one instance will install the updates.<br>
  I am taking a variable globally called <code>noOfInstances</code>(semaphore) initialized to <code>0</code>. Once a new instance is opened the variable will be incremented by 1. If there are 4 open instances then the value of <code>noOfInstances</code> will be 4. Once a instance is closed the value will be decreased by 1. For installing the updates I am writing:-</p>
  
  <pre><code>if(noOfInstances == 1)
  {
     InstallUpdates();
  }
  </code></pre>
  
  <p>Now my problem is that how to track programmatically that there is an instance opened of my project? There may be some unique Id for each instance which I am not able to identify. I am using windows environment to develop my c# application. </p>