Garbage Collection - Impact on other processes

G

Guest

Hello,

Our application will have a few managed and unmanaged processes running at
all times. What happens to the managed and unmanaged processes when the
garbage collector runs? Are they all suspended until garbage collection
completes or only the managed processes?
 
G

Guest

The GC only suspends the threads of the collecting app. All other apps,
managed or unmanaged, are untouched.
 
G

Guest

Thank you. I just wanted to clarify your statement that "The GC only
suspends the threads of the collecting app".

Does this mean that the garbage collector only suspends the application
whose memory is currently being collected? If six garbage collected
processes are running, then would each of the six be briefly suspended while
their own memory was garbage collected? Does this mean that at any given
time during garbage collection, that only 1 process will be suspended and the
other five will be running normally?
 
G

Guest

Each managed app has it's own GC instance. So when an app requests an
allocation that in turn requires collection, the GC suspends all threads in
that process. All other processes, whether managed or unmanaged, are
completely unaffected.

Of course if a collection is occuring, it's likely that resources are low,
so other apps are going to be more likely to collect at that point as well,
and if it's collecting becasue of a WM_HIBERNATE message, then you know that
it was a broadcast to all applications and all managed apps will BE
collecting at that point. So while the GC of each process isn't inherently
linked, since collection is tied to available resources, and resources are
shared among all processes, it's quite possible for events to occur that
would lead to multiple processes to be collecting at the same time.

-Chris
 
G

Guest

Thanks again for your helpful replies.

To follow up on your last reply, if the GC starts executing for a given
managed
process can it be interrupted by another higher priority thread in another
process?
 
G

Guest

You want to know if the GC can be interrupted?

The thread under which the GC runs is a thread like any other thread running
in the system. It follows the same rules for priority and quantum in place
for the entire system. So the scheduler will run the thread for it's life
or the quantum period, whichever is smaller, at which point it will then
switch to run another task. If a higher-priority item comes in, then the
scheduler will stop execution of the lower priority thread and migrate to
the higher one

IIRC when the GC runs it increases the priority of the thread it's running
on, but only a couple points at most, so it's still down around 250 or 251.
I'm not certain on this point, but I think I saw that behavior in testing.

-Chris
 
G

Guest

Yes, in fact I'm the one who wrote that presentation and presented it
originally at MEDC US.

-Chris
 

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