Originally posted by Nicholas Jordan:
Well why would it? We get a wide range of skills here, just to ask the question suggested to me you would recognize the need to apply the linguistic effectively, that was the first program I wrote in Java.
Why would one NOT code to parallelization?.....
That would be an app that could gain nothing from multi-core, no?
Originally posted by Peter Johnson:
For a single-threaded Java app, there is no benefit to going with multiple cores. For a multi-threaded app (such as a Java EE application server) there are significant benefits going multi-core.
I have written demo apps that scale linearly up to 32 processors. If I had more cores I could have gone higher. But that was a very artificial app that ran completely independent threads, each of which had a small enough working set that it fit into the processor cache.
However, when the threads interact, or depend on shared or synchronized data, then there is usually a sweet spot. For example, 8 cores might get the best performance, while using either more or fewer cores results in diminished performance (here performance being throughput). The only way to determine the sweet spot for your app is to run it under various configurations and tune it.
Originally posted by Rusty Shackleford:
"Why would one NOT code to parallelization?....."
Because the program you are writing is not inherently parallel. - True Dat!
Because the extra time it takes to refactor it outweighs any speed benefit. - True Dat!
Because the code you programmed in parallel runs slower on multiple cores.-Sometimes, but mostly if you have contention bottlenecks
At least on the desktop, the future is not parallelized programs. In my opinion, the future is the OS running a process on one core, another on the second, etc. In many cases, be it desktop, server or whatever, this will be a more optimal solution.
If a program, no matter what space is runs in, can be made to run in parallel that doesn't mean it is going to run faster. Take an extreme example: a program that has be written so that 80% of the execution time can run in parallel will not double in speed on 2 cores. It won't speed up 4x on cores, etc. In fact, with 4 cores you won't see a 2x performance boost. It all depends on the program and the processor architecture. Do the separate L1 caches need to communicate often? Is L2 shared? Write-through? Write-back?
"Take a scenario:
Exact same code + 2 CPU single core = ???
Exact same code + 1 CPU 8 core 4 thread/core = ???"
There is not enough information to be able to respond in any meaningful way. Java may hide the hardware details from the programmer but that doesn't mean it is irrelevant in terms of performance.
Dude, I agree, but "There is not enough information to be able to respond in any meaningful way"--that is the whole point...............
once again, JAVA, we are supposed to be the platform independent, highly scalable, platform performant model..................right? that was the whole point.
so what I am asking is vague no doubt, but I am not asking for evidence or numbers here, just the discussion. If the code doesn't explicitly thread in someway, if I go from a single core to a dual core, will I go faster? my answer again, is Yes, but not by much.......
[ June 11, 2008: Message edited by: Rusty Shackleford ]
For a single-threaded Java app, there is no benefit to going with multiple cores."--not entirely true bro, you can still collect garbage in parallel, whether you're in an app server or not.
we are supposed to be the platform independent, highly scalable, platform performant model..................right? that was the whole point.
A dual or quad does nothing for you.
Originally posted by William Brogden:
That assumes the operating system has no other tasks.
And usually a safe assumption in this context.