Understanding Java concurrency
At the beginning of this chapter, it was shown that even running a simple program (Example 2.2 and Figure 2.3) will cause multiple concretizations of threads (Figure 2.4). This means that a program thread created by executing the main
method did not create any other thread that belonged to that program. The Java platform is well-known and valuable for its ability to perform concurrent or parallel tasks.
We found out how and where initiated threads store their variables and why synchronizing objects located in the heap can lead to unwanted or unexpected program behavior. In this section, we will look at the possibilities of the main threads using the available CPUs.
The motivation for software designers to consider using any concurrent design patterns may be the growing need for better application responsiveness or throughput.
Although the platform already includes the Thread
class and the java.lang
package, Java concurrency features such as executors...