Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Apartment Model Thread
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00251823
Message ID:
00252516
Views:
8
>>there is really only a single thread of execution, if you need to have several >identical instance of a method to execute simultaneously, ytou need to use MTS >to manage multiple instances of the object.
>
>Nope. Wrong answer <s>...
>
>Just because VFP is single threaded doesn't mean it can't run concurrent requests. Apartment Model Threading allows for this to work by loading
>in essence multiple copies of your server into memory and running them
>side by side. They share a runtime, and they run in a single process
>but all their data is separate - stored in Thread Local Storage (TLS).
>In essence your VFP component is in fact running on multiple threads
>simultaneously (as evidenced by my examples).
>

I was aware that this happened with multiple interfaces, but not with a single interface referenced by multiple clients simultaneously. If this is the case, what manages thread affinity for a given client? I thought that MTS was needed to take care of the issue.

>The tool must support this by providing true local data for all instances
>and VFP does this in the MTDLL implementation of VFP. It did not provide
>the data protection in 6.0 though, although it was Apartment Model Threaded.
>Since data was not local, the blocking was forced on the runtime. SP3's
>MTDLL localizes all data and the blocking disappears.
>
>MTS doesn't help or hinder this process in anyway. MTS is just another
>multi-threaded client for a VFP COM object, just as IIS/ASP can be.
>
>A *true* multi-threaded component can run in a process's MTA (multi-threaded
>apartment) which is more efficient. A single copy of this component
>(data and code) can service all incoming requests because the component
>can run on any thread at any time. The component itself is responsible
>for being thread safe and isolating its data (typically via CriticalSections
>etc). COM doesn't need to fix up a special wrapper STA apartment for the
>object to run in first.
>
>MTA capable components can be very efficient, but IIS and MTS don't support
>them very well, so there's little benefit for them. MTA components make
>a lot of sense for ASP Application object components, but otherwise the
>benefits from standard MS apps is minimal.
>
>
>+++ Rick ---
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform