title: java multithreading performance scaling
body: <p>can you explain this nonsense to me?
  i have a method that basically fills up an array with mathematical operations. there's no I/O involved or anything. now, this method takes about 50 seconds to run, and the code is perfectly scalable (theoretically 100%), so i split it up into 4 threads, wait for them to complete, and reassemble the 4 arrays. now, i run the program on a quad core processor, expecting it to take about 15 seconds, and it actually takes 58 seconds. that's right: it takes longer! i see the cpu working 100%, and i know that each thread does 1/4 of the calculations, and creating threads and reassembling the arrays take about 1-2 ms in total.
  what's causing such loss of performance? what the hell is the cpu doing all that time?
  CODE: <a href="http://pastebin.com/cFUgiysw" rel="nofollow">http://pastebin.com/cFUgiysw</a></p>