Jérôme De Cuyper | 6 Nov 2010 01:56
Picon
Gravatar

Question regarding adding a new generation to mono's GC

This is my first message on the mono-gc mailing list and I hope I will not break any implicit rule it may have. Otherwise please let me know!

I decided to use my CS thesis as an opportunity to contribute some code to the mono project. Lupus kindly offered the following task:

"we currently have 2 generations: introduce a third one that sits between the nursery and the old generation. It should be a bump-pointer
style generation for fast gen0 collections."

Before starting to dig into the code, I need to justify the change that is proposed. I suppose the purpose of a new generation is to create a  group of objects from
a different age in order to recollect as much of them as possible before sending them to the two oldest generations. Is that correct?

Please correct me but I'm guessing the new flow of collection would be as follow: 

gen0 - newest objects - bump-pointer based
gen1 - middle aged objects  - bump-pointer based (the new generation)
gen2 - oldest generation - size-segregated freelists
gen3 - oldest generation - bump-pointer based

Thank you!

Jérôme De Cuyper
http://www.jdecuyper.com


_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list
Ciprian Mustiata | 6 Nov 2010 09:25
Picon

Re: Question regarding adding a new generation to mono's GC

You are right

As of today as SGen works is like this:
Gen0 (or nursery) and Old Generation split in two: the free list for large objects and the old generation.

Your task will consist in following: create Gen1 and you will have the following design:
Gen0: short lived objects
Gen1: medium lived objects (using bump-pointer)
Gen2: long lived objects (using bump-pointer)
GenFreeList: large objects (regardless of generation)

I really hope that your project will evolve nicely and I would love to see this addition to Mono runtime

On Sat, Nov 6, 2010 at 1:56 AM, Jérôme De Cuyper <jerome.decuyper <at> gmail.com> wrote:
This is my first message on the mono-gc mailing list and I hope I will not break any implicit rule it may have. Otherwise please let me know!

I decided to use my CS thesis as an opportunity to contribute some code to the mono project. Lupus kindly offered the following task:

"we currently have 2 generations: introduce a third one that sits between the nursery and the old generation. It should be a bump-pointer
style generation for fast gen0 collections."

Before starting to dig into the code, I need to justify the change that is proposed. I suppose the purpose of a new generation is to create a  group of objects from
a different age in order to recollect as much of them as possible before sending them to the two oldest generations. Is that correct?

Please correct me but I'm guessing the new flow of collection would be as follow: 

gen0 - newest objects - bump-pointer based
gen1 - middle aged objects  - bump-pointer based (the new generation)
gen2 - oldest generation - size-segregated freelists
gen3 - oldest generation - bump-pointer based

Thank you!

Jérôme De Cuyper
http://www.jdecuyper.com



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list


_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list
Jérôme De Cuyper | 8 Nov 2010 04:38
Picon
Gravatar

Re: Question regarding adding a new generation to mono's GC

Thank you Ciprian! The design is clear and understood! 


I will definitively have a look in the literature but do you have any idea what would be the main reasons to have an additional generation and what kind of benefits it would bring? 

My guess is: 
- delaying a too quick promotion to the older generation may help cleaning up medium lived objects that otherwise would not be collected until a full scan is fired
- Gen1 will certainly be smaller than Gen2 and therefore also quicker to scan.
- having an additional generation may contribute in minimizing the time occupied by the "stop the world" mechanism 
- increase the number of collected unreachable objects before firing a full scan

Am I in the right track?

On Sat, Nov 6, 2010 at 2:25 AM, Ciprian Mustiata <ciprian.mustiata <at> gmail.com> wrote:
You are right

As of today as SGen works is like this:
Gen0 (or nursery) and Old Generation split in two: the free list for large objects and the old generation.

Your task will consist in following: create Gen1 and you will have the following design:
Gen0: short lived objects
Gen1: medium lived objects (using bump-pointer)
Gen2: long lived objects (using bump-pointer)
GenFreeList: large objects (regardless of generation)

I really hope that your project will evolve nicely and I would love to see this addition to Mono runtime

On Sat, Nov 6, 2010 at 1:56 AM, Jérôme De Cuyper <jerome.decuyper <at> gmail.com> wrote:
This is my first message on the mono-gc mailing list and I hope I will not break any implicit rule it may have. Otherwise please let me know!

I decided to use my CS thesis as an opportunity to contribute some code to the mono project. Lupus kindly offered the following task:

"we currently have 2 generations: introduce a third one that sits between the nursery and the old generation. It should be a bump-pointer
style generation for fast gen0 collections."

Before starting to dig into the code, I need to justify the change that is proposed. I suppose the purpose of a new generation is to create a  group of objects from
a different age in order to recollect as much of them as possible before sending them to the two oldest generations. Is that correct?

Please correct me but I'm guessing the new flow of collection would be as follow: 

gen0 - newest objects - bump-pointer based
gen1 - middle aged objects  - bump-pointer based (the new generation)
gen2 - oldest generation - size-segregated freelists
gen3 - oldest generation - bump-pointer based

Thank you!

Jérôme De Cuyper
http://www.jdecuyper.com



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list


_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list
Rodrigo Kumpera | 8 Nov 2010 07:08
Picon
Gravatar

Re: Question regarding adding a new generation to mono's GC

Hi Jérôme,

First, a minor correction on the current setup of sgen. Right now mono use a 2 generations / 4 spaces setup.

There are 2 generations: young and old.
There are 4 spaces: nursery, major, los and los-huge.

The distinction before generation and spaces is important when discussing things like write barriers and collections.
We have los and los-huge to better handle allocation of large objects[1] against huge objects.

Said that, adding the extra generation will certainly help making gen0 collections faster. Some aspects of it
are kind of open questions that will require experimentation as their answer are not always obvious.

Things like how handle write barrier efficiently and figuring out a good size relation between gen0 and gen1.

I would love to see someone interested in cracking this issue. 

Cheers,
Rodrigo

[1]Right now between 8k and 1020k


On Fri, Nov 5, 2010 at 10:56 PM, Jérôme De Cuyper <jerome.decuyper <at> gmail.com> wrote:
This is my first message on the mono-gc mailing list and I hope I will not break any implicit rule it may have. Otherwise please let me know!

I decided to use my CS thesis as an opportunity to contribute some code to the mono project. Lupus kindly offered the following task:

"we currently have 2 generations: introduce a third one that sits between the nursery and the old generation. It should be a bump-pointer
style generation for fast gen0 collections."

Before starting to dig into the code, I need to justify the change that is proposed. I suppose the purpose of a new generation is to create a  group of objects from
a different age in order to recollect as much of them as possible before sending them to the two oldest generations. Is that correct?

Please correct me but I'm guessing the new flow of collection would be as follow: 

gen0 - newest objects - bump-pointer based
gen1 - middle aged objects  - bump-pointer based (the new generation)
gen2 - oldest generation - size-segregated freelists
gen3 - oldest generation - bump-pointer based

Thank you!

Jérôme De Cuyper
http://www.jdecuyper.com



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list


_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list
Jérôme De Cuyper | 9 Nov 2010 21:41
Picon
Gravatar

Re: Question regarding adding a new generation to mono's GC

Hi Rodrigo!


The new generation/space configuration would look like:

3 generations: young, middle-aged and old.
There are 5 spaces: nursery, kinder or kindergarten, major, los and los-huge.

Once there is no free memory available in the nursery, the garbage collector will trigger a nursery collection which will use a copying collection to move the live objects from the nursery to the kinder generation (which may be faster than copying it to the older generation). Once the kinder generation is full, a kinder collection will be fired to move the live objects to the older generation. At first sight, a problem can arise if during a nursery collection the kinder generation gets out of space. This could be avoided if the kinder generation always has enough space to hold at least all objects from the nursery. 

Is there an easy way to "watch" what the GC is doing in detail or do I need to create some kind of log functionality?

When testing out SGen, are there any test applications with typical behavior that I should be using? Or how should I be testing it?

Cheers.

Jérôme De Cuyper
http://www.jdecuyper.com




On Mon, Nov 8, 2010 at 12:08 AM, Rodrigo Kumpera <kumpera <at> gmail.com> wrote:
Hi Jérôme,

First, a minor correction on the current setup of sgen. Right now mono use a 2 generations / 4 spaces setup.

There are 2 generations: young and old.
There are 4 spaces: nursery, major, los and los-huge.

The distinction before generation and spaces is important when discussing things like write barriers and collections.
We have los and los-huge to better handle allocation of large objects[1] against huge objects.

Said that, adding the extra generation will certainly help making gen0 collections faster. Some aspects of it
are kind of open questions that will require experimentation as their answer are not always obvious.

Things like how handle write barrier efficiently and figuring out a good size relation between gen0 and gen1.

I would love to see someone interested in cracking this issue. 

Cheers,
Rodrigo

[1]Right now between 8k and 1020k


On Fri, Nov 5, 2010 at 10:56 PM, Jérôme De Cuyper <jerome.decuyper <at> gmail.com> wrote:
This is my first message on the mono-gc mailing list and I hope I will not break any implicit rule it may have. Otherwise please let me know!

I decided to use my CS thesis as an opportunity to contribute some code to the mono project. Lupus kindly offered the following task:

"we currently have 2 generations: introduce a third one that sits between the nursery and the old generation. It should be a bump-pointer
style generation for fast gen0 collections."

Before starting to dig into the code, I need to justify the change that is proposed. I suppose the purpose of a new generation is to create a  group of objects from
a different age in order to recollect as much of them as possible before sending them to the two oldest generations. Is that correct?

Please correct me but I'm guessing the new flow of collection would be as follow: 

gen0 - newest objects - bump-pointer based
gen1 - middle aged objects  - bump-pointer based (the new generation)
gen2 - oldest generation - size-segregated freelists
gen3 - oldest generation - bump-pointer based

Thank you!

Jérôme De Cuyper
http://www.jdecuyper.com



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list



_______________________________________________
Mono-gc-list maillist  -  Mono-gc-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-gc-list

Gmane