Enterprise-level applications often need more CPU power than any single-CPU machine can provide, but getting an application to effectively use multiple CPUs can be tricky. If you are lucky, your application may be able to run on separate single-CPU machines. Web servers scale this way. But many applications, such as databases, need to run on a single machine.
If your application must be run on a single machine, you have to add CPUs to scale it. One strategy for using multiple CPUs in that machine is to run multiple processes and have them communicate via the various forms of interprocess communication, such as semaphores and shared memory. The operating system will automatically allocate different CPUs to different processes. But interprocess communication techniques are not especially portable.
Native thread libraries provide a way to use multiple CPUs in a single process, and can be relatively portable, but native thread programming is difficult. Java thread programming, by comparison, is simple. Not only is Java thread programming simple, but programs using Java threads are extremely portable, and Java threads have been advertised as scaling well on multi-CPU machines. As we’ll see next, this has not been entirely true in recent versions of Java, but there are some simple things you can do to maximize Java multithreading performance on multi-CPU machines.
Getting multiple equivalent CPUs to cooperate in a single machine is known as Symmetric ...