cual core, quad core, i3,i5,i7 optimized and 100% cpu's
Hello,
I would like a sample source code for create a program where use 100% of all CPU's/cores on dual/quad core or new I3,I5,I7.
For example: i have a simple program for calculating a numbers, but, when i start only have usage 50% of my dual core, the other is 0% usage. I would like use the two cores at time.
Re: cual core, quad core, i3,i5,i7 optimized and 100% cpu's
can use a infinite for loop...
Code:
for (;;)
{
for (;;)
{
//some stuffs.. like:: FindWindow(). Finding a window that is not created yet. so the loop continues.
//a break statements if you want to terminate infinite loop.
}
}
Last edited by hypheni; July 26th, 2010 at 05:36 AM.
Re: cual core, quad core, i3,i5,i7 optimized and 100% cpu's
To use multiple cores simultaneously, your code needs to start multiple threads.
Multiple child threads belonging to a single task doesn't always mean multiple cores are used... this all depends on the OS and the optimization used by the OS and which instructions are used. So, which OS is used for this question ?
Re: cual core, quad core, i3,i5,i7 optimized and 100% cpu's
See. Some days back I used a for(; with some statements inside on my dual core win xp machine and it was almost utilizing 90-100% of cpus. Multiple threading will be a good choice but I think putting preferred statements in nested for(; also utilize 100% of cpu. It depends on what you are putting inside the loop.
Last edited by hypheni; July 27th, 2010 at 12:43 AM.
Bookmarks