Skip to Main Content
COM & .NET Component Services
book

COM & .NET Component Services

by Juval Lowy
September 2001
Intermediate to advanced content levelIntermediate to advanced
384 pages
11h 59m
English
O'Reilly Media, Inc.
Content preview from COM & .NET Component Services

The Neutral Threaded Apartment

The neutral threaded apartment (NTA) is a new threading model available only on Windows 2000. Although it is not specific to COM+ (classic COM objects can also take advantage of the NTA), the NTA is the recommended threading model for most COM+ objects that do not have a user interface.

The NTA has evolved to address a deficiency in the classic COM MTA threading model: suppose you have an STA client accessing an MTA object. Under classic COM, all cross-apartment calls have to be marshaled via a proxy/stub pair. Even though the object could have handled the call on the client STA thread, the call is marshaled. The stub performed an expensive thread context switch to an RPC thread to access the MTA objects.

There was clearly a need for an apartment that every thread in the process could enter without paying a heavy performance penalty. This is what the NTA is: an apartment that every COM-aware thread can enter. In every process, there is exactly one NTA. The NTA is subdivided (like any other apartment) into contexts. COM objects that reside in the NTA set their threading model value in the Registry to Neutral.

Much like an MTA object, an object marked as neutral will reside in the NTA, regardless of its creator’s apartment. Calls into the NTA are marshaled, but only light-weight proxies are used (to do cross COM+ context marshaling, if needed) because no thread-context switch is involved. A method call on an NTA object is executed on the caller’s ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Server® 2008 Security Resource Kit

Windows Server® 2008 Security Resource Kit

Jesper M. Johansson

Publisher Resources

ISBN: 0596001037Supplemental ContentCatalog PageErrata