"]\tStarted new socket server: " + socket);
We'll consider these last two as interesting possible designs that need some practical fleshing out.
Design patterns are an excellent tool for conceiving of and constructing programs. This is
especially relevant to threaded programs, where the interactions between the threads may become
complex. A pattern describes a design form consisting of the interfaces, classes, and objects that
make up a program and their interactions. As such, they are a more formal way of stating what we
have just described.
There are a series of well-thought-out patterns that are used in multithreaded programs. The use of
design patterns lies just above the focus of this topic, so we will not attempt to cover it at all. Doug
Lea's excellent book Concurrent Programming in Java is devoted to describing how such patterns
are designed and used (see Threads Books). We recommend it highly.
Numerous trade-offs exist in the creation of MT-safe and MT-hot libraries. No single locking
design works best for all programs. How different threads will interact and how they will be
created and exit are open questions. We offer a few insights and some examples. The most
important design issue is simplicity.
Search WWH :