Garbage collection and other questions I have

T

TomServo

HI everyone,
I have a couple of questions on Garbage collection :

1 : How many garbage collectors can run on for three one .NET
application?


2 : you create objects on a different generation in garbage
collection?


3 : What is the Best data structure for in memory caching, holding
around 1 gigabyte. HashTable
4 : If I was to create my own collection, how would I design it? What
would it implement?
5 : Assuming I have a static member class of a class that holds a list
of stocks, how would I design it? What considerations do I have for
it?
 
A

Alberto Poblacion

TomServo said:
I have a couple of questions on Garbage collection :

1 : How many garbage collectors can run on for three one .NET
application?

By default there is one Garbage Collector.

If you are running an application with many threads on a computer with many
cores, your performance may be limited by the Garbage Collector capacity to
allocate or deallocate fast enough.

The solution is to have many Garbage Collectors, each with their own thread.
This removes the limitation in exchange for some overhead. This is called
"Server Mode". In this mode, there is one Garbage Collector thread for each
CPU core, and one set of heaps for each garbage collector thread. The
application threads allocate from the heaps in a round-robin fashion.

To enable Server Mode, you set gcServer to true in the the app.config file:

<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>

http://msdn.microsoft.com/en-us/library/ms229357.aspx

Depending on your application, it may be useful intead to enable Concurrent
GC (which cannot be enabed simultaneously to Server Mode):
http://blogs.msdn.com/clyon/archive/2004/09/08/226981.aspx
 
T

TomServo

Hi Pete


3 : What is the Best data structure for in memory caching, holding
On what version of Windows? On any 32-bit version, I'd say that _no_ data
structure is good for holding 1GB of data. You'll be so close to the
maximum addressable space for your process, that you may well run into
problems regardless.

Ignoring the size issues, what data structure is best depends on how you
intend to use it. It's not possible to say what the best data structure
would be without knowing more specifics.

Well I would I say that ignoring size and machine capacity, I would speed of
lookup is the most important factor, second probably is ability to persist on
hard drive fast.
It would implement the best data structure for your usage, and presumably
you'd only be implementing your own data structure because .NET doesn't
offer an implementation of what turns out to be the best data structure
for your usage.

Again, without knowing how you intend to use the data, there's no way to
comment on what the best data structure would be. The size of the data
structure is a lot less important than the usage pattern of the data.

The data will be frequently updated ( probably every 2 second ) and needs to
be fast and lighweight. Lookup is most important.

Thanks a lot for your reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top