I need to find out, how many cores are available on a server at that moment. For example, it is a 8 core machine and running at 50% CPU utilization. Can this be assumed as 4 cores are available? or is there a more sophisticated way to determine number of cores available.
Few observations I had was that, there may be 50 system processes active on that machine but most of them will be in dormant state for majority of time. Few of them will wake up and do few millisecond worth of task and then sleep again. So I need to understand, what calculation run behind the scene for calculating CPU utilization and how can I use that to determine free cores.