Reputation: 752
I have N same program running in the same time
Is it better to give each of them their individual .dll? or this does not effect the performance. (in terms of speed? or memory allocation?)
Thanks
Upvotes: 0
Views: 49
Reputation: 41454
You mean, have a separate DLL file on disk? It does not affect speed or memory allocation. Importing a DLL causes the DLL's contents to be loaded into the individual program's memory space, so multiple programs using the same DLL will actually be using a different "copy" of it. (Note "copy" in quotes: The same physical memory may be used for the DLL's code in multiple program instances. If so, then using the same DLL for all will decrease overall physical memory usage, but you can't count on this.)
Upvotes: 2
Reputation: 137
Depends on your N value. It is always better to use a combined method. That is to have a maximum number (say 5 or 10, depending on the usage of the dll) instances of the same program accessing the same dll without a noticeable delay, and if there are more than the said delimiting number it's better to create another copy of the dll and allocate them to the new instances.
Again, it depends on the N value, how much of a delay a usage of the dll causes etc. The reason why making multiple dlls is discouraged is it uses a lot of space as well as if N is large, it could obsoletely create 10 schoolbuses to transport 10 school children who live in 10 different places.
Upvotes: 0