From: Tom Shelton on 13 Aug 2010 15:22 BeeJ submitted this idea : > Paul Clement formulated the question : >> On Fri, 13 Aug 2010 09:34:21 -0700, BeeJ <nospam(a)live.com> wrote: >> >> � So what is happening? >> � In both cases I have set Thread Per Object. >> � I instantiate four of the same ActiveX EXEs (set as an array of Ax(). >> � With SingleUse I see all four in Process Explorer. >> � with MultiUse I see one in Process Explorer. >> � The Main App runs and uses what is provided in either case but ... >> � � Is the MultiUse some sort of reentrant thing? >> � Is there only one copy in memory? >> � How is the CPU interacting with these? >> � � All are working at the same time (as sliced). >> � But maybe the timing is better with SingleUse. i.e. I could run faster � >> due to lower overhead. >> � � Sorry I do not know the terminology to research this and if I did I � >> probably would not get the gist of it. >> � Still in learning mode ... thanks for your patience. >> � >> >> Some your questions would require a little more info, but you can find the >> differences between Instancing values documented in the below article: >> >> http://msdn.microsoft.com/en-us/library/aa242107%28VS.60%29.aspx >> >> >> Paul >> ~~~~ >> Microsoft MVP (Visual Basic) > > Well not what I was after. I saw similar in MSDN Help (F1) from the IDE. I > am more interested in what the CPU does. > When only one appears in Process Explorer and i have instantiated four, what > is really going on? A new thread is started in the ax exe process, and the object is created on that thread. > I left the question slightly ambiguous to get outside > the box responses that give me more fodder. > Is there more overhead? Actually, less. Windows is is very slow at starting processes (when compared to other os's) - but, pretty quick at starting threads. With a singleuse, it has to start the process, start the thread for the object, initialize the thread for tls and com, and then create the object. With the multiuse, you only get the process start overhead on the very first client to connect. After that, its just start the thread, initialize tls and com, create the object. Not to mention, that each process will get a much larger piece of memory then they really need. > These are small ActiveX EXE with no global data to speak of so having four in > memory does not seem like too much but ... ? There is no such thing as global data in a activex exe. VB.CLASSIC's threading model is single appartment threading. Which means, that it uses Thread Local Storage (TLS). Everytime, a new thread is spawned, they get their own fresh copy of the global data - meaning, global values are global to the thread, not the process. This is the reason it's sort of a pain to do cross thread communication in vb.CLASSIC. Of course, it's also makes simple threading scenarios - where each object is independant and there isn't a lot of cross thread chatter going on - a bit simpler, because you don't have to worry about explicit syncronization. > If I need more speed or more assurance that something will get done when I > request it? The difference between singleuse and multiuse isn't going to make much difference for long lasting objects. In other words, if you create them and then hold on to them for the life of your program, it's not as big a deal as if you are in a loop creating short lived objects... For the shorter lifetimes, multiuse is going to be better (though still sucky as that is just the nature of com reference counting... there is a lot of overhead in object creation) -- Tom Shelton
From: Tom Shelton on 13 Aug 2010 15:26 Jim Mack brought next idea : > BeeJ wrote: > >> When only one appears in Process Explorer and i have instantiated >> four, what is really going on? I left the question slightly >> ambiguous to get outside the box responses that give me more fodder. >> Is there more overhead? > > Processes don't run -- only threads run. Four processes each with a > single thread shouldn't work any faster or slower than four threads in > a single process. > > There will be startup overhead for each process and for each thread, > and some small memory overhead for each process, but aside from that > it should make no difference to performance. Actually... It can make a difference in certain scenarios... If you are creating short lived objects, then you incure the pretty weighty overhead of process startup on every object instantiation. But, if you are dealing with long lived objects in general, it's not going to make a difference. -- Tom Shelton
From: Mike Williams on 13 Aug 2010 15:45 "Tom Shelton" <tom_shelton(a)comcast.invalid> wrote in message news:i4469u$bl7$1(a)news.eternal-september.org... > Actually... It can make a difference in certain scenarios... Hi Tom. Any idea where your friend Senn (aka Tom the bank clerk) is? We haven't seen him since he was unfrocked. Has he told you where he has gone, or has he left you in the dark as well? Mike
From: Tom Shelton on 13 Aug 2010 15:57 Mike Williams formulated the question : > "Tom Shelton" <tom_shelton(a)comcast.invalid> wrote in message > news:i4469u$bl7$1(a)news.eternal-september.org... > >> Actually... It can make a difference in certain scenarios... > > Hi Tom. Any idea where your friend Senn (aka Tom the bank clerk) is? We > haven't seen him since he was unfrocked. Has he told you where he has gone, > or has he left you in the dark as well? > > Mike Nice try. I know nothing about senn... other then what i've seen in his posts. -- Tom Shelton
From: Mike Williams on 13 Aug 2010 16:44 "Tom Shelton" <tom_shelton(a)comcast.invalid> wrote in message news:i4482p$s15$1(a)news.eternal-september.org... >> Mike Williams formulated the question : >> Hi Tom. Any idea where your friend Senn (aka Tom the bank >> clerk) is? We haven't seen him since he was unfrocked. Has he >> told you where he has gone, or has he left you in the dark as well? > > Nice try. I know nothing about senn... other then what i've > seen in his posts. No problem, Tom. In fact I wasn't really interested in Senn or his whereabouts. I was just checking the sincerity of your recent statement that I will get no further reply from you until I effectively toe the party line ;-) Mike
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: MsgBox and a pop up form Next: Read XML using VB6 DOM 4.0 with Namespaces - See Sample XML |