(Page 3 of 9 in this chapter)
3.2 Programming Models
- CT Access is a collection of re-entrant libraries which are capable of supporting programming models to suit most application requirements. Both single-threaded (single-thread-per-process) and multi-threaded (multi-thread-per-process) operating systems are supported.
Each Windows NT process consumes approximately 3/4 megabyte of RAM. To save RAM, it is advised that you use multiple threads per process instead of multiple processes.
- The different programming models are created by the use of CTA contexts and event queues.
- This section contains three programming model examples with CT Access 1.0 components. Variations on these models are also supported.
- The following three configurations are discussed:
- Multiple contexts, multiple event queues
- Multiple contexts, one event queue
3.2.1 Single Context, Single Queue per Process
- The single context, single event queue configuration, depicted in Figure 15, is the simplest approach for application development. Multiple application processes are used, each with its own event queue.
- This configuration is mainly used in applications running on single-threaded operating systems and is best suited to systems with a low number of contexts.
- Using this configuration, applications can create synchronous wrappers allowing a sequential stateless thread of execution.

Figure 15. One Context, One Event Queue per Process
3.2.2 Multiple Contexts, Multiple Queues per Process
- The multiple context, multiple event queue configuration is used in applications running on multi-threaded operating systems. Each thread has its own event queue with one CTA context. The application can be developed with synchronous functions as in the single queue, single CTA context configuration.
- Since each thread controls an event queue it is acceptable for a thread to sleep waiting for an event from its services.

Figure 16. Multiple CTA Contexts, Multiple Event Queues per Process
3.2.3 Multiple Contexts, Single Queue per Process
- The multiple contexts, single queue configuration is the most efficient with respect to system resource utilization. The application process count and file system resource demand are minimized at the expense of development complexity.
- In this configuration, the queue receives events for all contexts. This dictates a state-machine model approach.

Figure 17. Multiple CTA Contexts, One Event Queue per Process
(Page 3 of 9 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.