I have a java program which extracts some files onto client machine. I have implemented 4 threads to extract files. But thread implementation barely effecting the extraction time. I have checked thread execution in jvisualvm, it looks fine and I am sure that threads are implemented parallel fashion . Here is my system configuration…
Windows XP, Core2duo, 3GB RAM.
java-vm-args : -Xmx512M -Xss2M.
I have printed available processors to the running JVM…
Runtime.getRuntime().availableProcessors() = 1( If I am not wrong it should execute 2 logical threads).
Am I missing something? How can we assure that threads are running parallel at Hardware level?
Parallel execution helps when CPU is bottleneck. In your case bottleneck is probably I/O, not CPU. Also, you have 1 physical core with hyper-threading. In this case parallel execution will probably not help anyway, even when CPU is bottleneck. Moreover, in some situations, two-threaded application may be slower on single-core, hyper-threading CPU than single-threaded application. Hyper-threading is mostly marketing trick. Do not rely on it.