By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The Lowdown on Threads
Do you understand all you need to know about threads and the COM+ object model? This tip, excerpted from InformIT, discusses the new threading models for COM+.
Threads are a sequence of execution steps within a component. Individual components can support one or more execution points operating simultaneously. Such components are known as multi-threaded components. Before Windows 2000, components could support either the single-threaded apartment (STA) model or the multi-threaded apartment (MTA) model. With the advent of Windows 2000 and COM+, components can now support the thread-neutral apartment (TNA). TNA components are essential to tapping the full feature set of COM+ because they eliminate many of the drawbacks of STA and MTA components.
STA components are confined to executing on just a single thread. This is problematic because it can result in deadlock situations in which a process holds the only available thread to a component, thus blocking other processes. MTA components solve the problem of a single thread by allowing multiple threads to operate within a given component. The problem with STA and MTA components, however, is that they suffer from restrictions on just which threads are allowed to run in the component. TNA components solve this problem by supporting any available thread at any time.
In all large applications, proper thread management is critical to scalability and performance. Regardless of the threading model in use, COM+ provides the underlying support to manage threads for your components. This means that STA, MTA, and TNA components all work with COM+; however, the choice of threading model can negatively affect other COM+ features.
The most significant consequence of using Visual Basic for COM+ development is that Visual Basic 6.0 doesn't support the thread-neutral apartment model. Visual Basic components support only the STA model. Microsoft has indicated that Visual Basic will support the TNA model under version 7.0.
To read more about COM+, click over to InformIT. You have to register, but registration is free.