DCE Application Programming Guide
Application Programming With NonStop DCE 
Threads
HP NonStop DCE Application Programming Guide—429551-003
3-15
Programs With Multiple Interdependent Application
Threads
state internally and that most servers can be context-free. In cases where context must 
be maintained across multiple requests, the context is generally private to the client 
and should not be shared.
Table 3-2 on page 3-4 summarizes the general considerations an application designer 
must be aware of when developing a DCE program with multiple independent 
application threads.
Programs With Multiple Interdependent Application Threads
Other programs containing multiple threads to execute concurrently are 
interdependent: they share application resources that exist in the process environment. 
For example, the threads in these programs can share application file opens, SQL 
cursors, and modifiable application data structures. These applications must use 
mutexes to synchronize access to the shared application resources.
An example of this type of program is a sophisticated DCE server that maintains 
application state in the server to improve performance or that shares resources, such 
as file opens, to reduce resource consumption. Another example is a client program 
that introduces parallelism into the application.
Programs with multiple interdependent application threads are the most complex. The 
complexity increases as application synchronization increases. Application 
synchronization can include using mutexes to reserve access to a shared resource and 
using condition variables to wait for a shared resource to be in a certain state.
Poor performance can result if inappropriate synchronization techniques are used. 
Synchronizing too infrequently can overly restrict concurrency by causing a server to 
serialize the processing of all RPCs, increasing the application’s service time. 
Synchronizing too frequently can result in an increase in the processor time spent 
initializing, obtaining, and releasing mutexes and dispatching threads. 
Keeping Application Design Simple
Because multithreaded programs are complex, application designers should consider 
these recommendations:
•
Write programs with a single application thread when possible.
•
Maintain application thread independence when possible. If this is not possible, 
keep the interdependencies to a minimum.










