Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Apartment Model Thread
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00251823
Message ID:
00252298
Vues:
10
>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).

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 ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform