A
Alexander Dong Back Kim
Dear members,
First of all, I apologize that this question is not 100% pure C++
question so some might be annoyed by this.
I'm writing a multithreading based application. The application can
use flexible number of threads while it's running (between 2~32
threads when it's needed or configured). My development machine has 8
CPU so the application I'm writing sometimes uses 600% of CPU usage
which was very impressive at the beginning. However, since the real
target machine has only 1 CPU and requires to run many other
applications at the same time, I think I should somehow limit the CPU
usage of my application (let say 30%.
I tried to use sleep() but I found out it's not good enough because I
want to explicitly define maximum CPU usage rate for this application.
Any suggestion or recommendation are welcomed and appreciated.
regards,
First of all, I apologize that this question is not 100% pure C++
question so some might be annoyed by this.
I'm writing a multithreading based application. The application can
use flexible number of threads while it's running (between 2~32
threads when it's needed or configured). My development machine has 8
CPU so the application I'm writing sometimes uses 600% of CPU usage
which was very impressive at the beginning. However, since the real
target machine has only 1 CPU and requires to run many other
applications at the same time, I think I should somehow limit the CPU
usage of my application (let say 30%.
I tried to use sleep() but I found out it's not good enough because I
want to explicitly define maximum CPU usage rate for this application.
Any suggestion or recommendation are welcomed and appreciated.
regards,