|
|
Preliminary Guidelines for Programming a Multithreaded/Multicontexted Application
Before you start coding, make sure you have fulfilled or thought about the following:
Prerequisites for a Multithreaded Application
Make sure your environment meets the following prerequisites before starting your development project.
The BEA Tuxedo system does not supply tools for creating threads, but it supports various threads packages provided by different operating systems. To create and synchronize threads, you must use the functions native to your operating system. To find out which, if any, threads packages are supported by your operating system, see Platform Data Sheets, in Installing the BEA Tuxedo System.
General Multithreaded Programming Considerations
Only experienced programmers should write multithreaded programs. In particular, programmers should already be familiar with basic design issues specific to this task, such as:
These are just a few of the issues, too numerous to list here, with which we assume any programmer undertaking the writing of a multithreaded program is already familiar. These issues are discussed in many commercially available books on the subject of multithreaded programming.
Concurrency Considerations
Multithreading enables different threads of an application to perform concurrent operations on the same conversation. We do not recommend this approach, but the BEA Tuxedo system does not forbid it. If different threads perform concurrent operations on the same conversation, the system acts as if the concurrent calls were issued in some arbitrary order.
When programming with multiple threads, you must manage the concurrency among them by using mutexes or other concurrency-control functions. Here are three examples of the need for concurrency control.
For most applications, the best strategy is to code all the operations for one conversation in one thread. The second best strategy is to serialize these operations using concurrency control.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|