How do I get Java to use my multi-core processor?

Posted by Rudiger on Stack Overflow See other posts from Stack Overflow or by Rudiger
Published on 2010-01-01T21:08:38Z Indexed on 2010/05/10 8:34 UTC
Read the original article Hit count: 331

Filed under:
|
|
|
|

I'm using a GZIPInputStream in my program, and I know that the performance would be helped if I could get Java running my program in parallel.

In general, is there a command-line option for the standard VM to run on many cores? It's running on just one as it is.

Thanks!

Edit

I'm running plain ol' Java SE 6 update 17 on Windows XP.

Would putting the GZIPInputStream on a separate thread explicitly help? No! Do not put the GZIPInputStream on a separate thread! Do NOT multithread I/O!

Edit 2

I suppose I/O is the bottleneck, as I'm reading and writing to the same disk...

In general, though, is there a way to make GZIPInputStream faster? Or a replacement for GZIPInputStream that runs parallel?

Edit 3 Code snippet I used:

GZIPInputStream gzip = new GZIPInputStream(new FileInputStream(INPUT_FILENAME)); DataInputStream in = new DataInputStream(new BufferedInputStream(gzip));

© Stack Overflow or respective owner

Related posts about java

Related posts about Performance