I am doing dual core optimization by multi-threading, and it works like this:
If the device has dual-core processor, two threads are created to do the computation, and if the device has only one-core processor, only one thread is created to do the computation.
My question is: how does my program know whether a device is dual-core or not?
I just want to have one program that can run on both dual-core and one-core devices, so it has to be able to know that information.
code like this:
if( xxx_API_is_device_dual_core() ) // Inside if() is the expected API
{
saveThread = new SaveThread[2];
}
else
{
saveThread = new SaveThread[1];
}
Thank you very much for any help!
Is Runtime.availableProcessors() fails to report correctly on the 2-core device?