Is there a way to improve performance of the java module by utilizing the second processor on a dual processor machine? To be precise, can I execute two threads and specify exclusively to each one of them which processor (CPU) they should utilize? How a dual processor machine can be used efficiently to improve the performance of a java application?
There's no way to specify the "CPU affinity" of a thread; but if you create multiple threads on a multiprocessor machine, then a well-implemented JVM will schedule them efficiently on the available processors. I've had dual-CPU Xeons for years now, and find that under both Linux and Windows, multi-threaded CPU-bound programs see an appropriate speedup on multiprocessor machines.
Improve java's performance to the detriment of which other program? This kind of thing is handled automatically by the operating system. If two CPUs are available and you have a program that can run concurrently, then the OS will likely make use of both CPUs. But you will not have exclusive or dedicated access.