title: How to detect current Process/Thread starvation in .NET
body: <p>I'm working on a soft realtime application which is deployed to many servers that have differing amount of load due to other processes. We've determined that in at least one setup, the performance was hindered by a lack of enough cpu resource.</p>
  
  <p>I understand that on Windows a thread/process can enter the Ready state and that if a cpu is not available it will remain in that state.</p>
  
  <p>I was kind of hoping that there would be a call like Process.Current.ReadyTime that would allow me to inspect and monitor this occurring and raise warnings/errors within the application log. You could take delta's across a known time period and have a threshold for how much time you'd tolerate being in a Ready state for example.</p>
  
  <p>I'm having trouble finding any direct or even indirect way of getting that though. Does anyone have any ideas how to achieve this or something similar?</p>
  
  <p><strong>TL;DR</strong> - We're looking for a way for a thread/process to inspect how long it has been in the Ready state (i.e. got work to do but no cpu available)</p>
  
  <p>Thanks,</p>
  
  <p>G-Man</p>