| < Day Day Up > |
|
Thread-based programming in Java involves understanding how to create threads and how to control them with the synchronize keyword and wait and notify methods. This understanding is non-trivial, as the presence of threads produces nondeterministic behavior in the programs. To understand the effects of nondeterminism in a program it is necessary for the programmer to understand how a concurrent program executes and whether or not resources such as variables are actually shared. Understanding the context of each thread allows the programmer to reason about these issues. Race conditions and deadlock are two types of problems that can arise with thread programs and concurrent programs, in general, and that do not exist in procedural programming. The best way to deal with these problems is to use standard designs for components that are well understood and known to be correct. A programmer who implements solutions in any other manner needs to be very careful and should prove that the program is correct.
| < Day Day Up > |
|