Chapter 10: Concurrent Programs


Overview

Only a few years ago, the majority of software developers were able to concentrate on problems occurring when a program executed one single sequential command stream. Today, very few applications run sequentially; the catchword is concurrent.

The principle of concurrency is based on the concept of things happening at the same time. Concurrency can be purely virtual, like the execution of a program on a computer with one single processor. But it can be actually present, when several processors or even several computers are involved.

We distinguish between processes and threads. Most operating systems seal off processes from one another, which means that processes have to communicate over explicit communication channels (e.g., pipes). In contrast, threads are "lighter"; they share a process and thus an address space, but they have their own program counter and their own stack. This means that threads represent the smallest unit for the allocation of computing time (i.e., scheduling). This chapter concentrates on threads, because they represent the standard mechanism for concurrency in Java.

Java makes it easy for the developer to create and start threads. This functionality is provided by the class java.util.Thread. In addition, Java offers possibilities for synchronization between threads, using the keyword synchronized and the methods wait() and notify(), located in the Object class. This chapter assumes that the reader has basic knowledge of these Java features. The basic concepts are discussed and explained in many introductory Java textbooks [Hyde99].




Unit Testing in Java. How Tests Drive the Code
Unit Testing in Java: How Tests Drive the Code (The Morgan Kaufmann Series in Software Engineering and Programming)
ISBN: 1558608680
EAN: 2147483647
Year: 2003
Pages: 144
Authors: Johannes Link

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net