Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How approaches of the GC works?

$
0
0

Hi,

I have gone through the GC. I am unable to grab the contents in MSDN. I have referred some sites.
Finally, I have little confusion and queries.

Could some one tell that, my understanding is correct?

What I understood is:

As shown above,the heap will be divided into 3 small heaps(Gen 0,1,2)
and each of them will grow or shrink in size, according to the need.

Inside each heap, there will be two region named, small object heap and large object heap.
Of them the first 2 gen's are ephemeral(lasting for very small time - as synonym says).

Clean-up  Approaches:-

1. Concurrent Garbage Collector:-
It will follow the "stop world" concept for the gen 0 and gen 1,since a small pause to the UI thread(who require the small space), will not make a big deal.  
(A)"Question:" Is it a thread or normal function which will do this block mechanisms.?
A separate thread will do the cleaning for the gen-2 and if any needed situation arises, it will block the UI thread when it requires a big space.
And gen2's GC thread will run parallel to the UI thread, when there is a need for the garbage collection. That's why it is named as Concurrent.
(B)Question:- These two garbage collection(G0,G1 and G2) process/threads will work parallel?

2. Background Garbage Collector:-
The ephemeral gen's are cleared by a separate thread (Foreground garbage collector thread and as usual it will block the UI thread if no enough space) and gen2 is cleared byseperate thread(C).
And 2nd gen GC thread will pause and resume, based upon the state of the Foreground thread.

(C)Question:- Is this thread will not perform the blocking call to the UI thread when some one requires a bulk space?
(My Thinking and Query:- It will not block, as the name suggest, it will run in the background.
But what if some one requires a large space and that space is not avail?. What approach it will follow?)

Since it is a single concept, i have asked questions, instead of a seperate thread.

Thanks in advance.


NANDAKUMAR.T


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>