Thread overview
Dernel: Using D's GC as kernel memory manager?
Feb 24, 2004
Robert M. Münch
Feb 25, 2004
Andrew Edwards
Feb 25, 2004
Robert M. Münch
Feb 25, 2004
Andrew
Feb 25, 2004
Walter
Feb 25, 2004
Robert M. Münch
February 24, 2004
Hi, I'm thinking about directly using the GC as the kernel low-level memory manager. I'm not sure if this works but to me the GC just looks like a good memory-manager. I know how much physical memory the booted system has, so knowing the lower- and upper-bound is no problem.

Maybe it's a good idea to setup two instances of a GC. One for the kernel itself and one for user-programs to link against. This is future music but worth thinking about it. Walter, would it be possible to have two instances of a GC running? IMO the compiler would need to use calls like gc2.XYZ.

Does the GC perform heap compaction? How does this work? Will this "only" merge adjacent free memory regions or will this move allocated memory to get bigger free chunks? The later I don't think so, how will all the pointer references be updated...

Of course adding virtual memory support needs to be done later. I have to lookup all the GDT and LDT Intel stuff for this...

Has anybody already worked thru the garbage collector code? Every piece of documentation, help will help me too :-))

-- 
Robert M. Münch
Management & IT Freelancer
http://www.robertmuench.de
February 25, 2004
Robert M. Münch wrote:

[snip] all concerns I wouldn't know how to address!

I would like to request permission to tag along IOT learn about Operating System development. What would I need and what are some locations I can turn to for resources and guiance?

Thanks,
Andrew

February 25, 2004
"Robert M. Münch" <robert.muench@robertmuench.de> wrote in message news:opr3wddht5heztw6@news.digitalmars.com...
> Hi, I'm thinking about directly using the GC as the kernel low-level memory manager. I'm not sure if this works but to me the GC just looks like a good memory-manager. I know how much physical memory the booted system has, so knowing the lower- and upper-bound is no problem.
>
> Maybe it's a good idea to setup two instances of a GC. One for the kernel itself and one for user-programs to link against. This is future music but worth thinking about it. Walter, would it be possible to have two instances of a GC running? IMO the compiler would need to use calls like gc2.XYZ.

Two instances can run as long as they have they don't share heaps.

> Does the GC perform heap compaction?

No, but a future version might.

> How does this work? Will this "only"
> merge adjacent free memory regions or will this move allocated memory to
> get bigger free chunks? The later I don't think so, how will all the
> pointer references be updated...

A compacting gc is possible, and I've done one before. The trick is knowing when to update pointer references <g>.

> Of course adding virtual memory support needs to be done later. I have to lookup all the GDT and LDT Intel stuff for this...
>
> Has anybody already worked thru the garbage collector code? Every piece of documentation, help will help me too :-))

All the documentation there is is in the source <g>.


February 25, 2004
On Tue, 24 Feb 2004 17:11:32 -0800, Walter <walter@digitalmars.com> wrote:

> Two instances can run as long as they have they don't share heaps.

Hi, well that's what I thought too ;-) The question is how to use one time GC_A and one time GC_B.

My current idea is somehow to flag all kernel classes (maybe by deriving every kernel class from an empty abstract base class) so that the calls to new can find out if this is a kernel allocation or not. The implementaitons of _d_new* would handle this.

An other option would be to create a custom allocator (if this is possible at all) for kenerl stuff.

I prefer option 1.

> No, but a future version might.

Ok.

> A compacting gc is possible, and I've done one before. The trick is knowing when to update pointer references <g>.

Walter, what would I do without such helpful hints ;-) I will postpone my efforts until we will see your version :-)

> All the documentation there is is in the source <g>.

Yes I know: The source is with you Robert. Use the source.
February 25, 2004
On Tue, 24 Feb 2004 20:11:21 -0500, Andrew Edwards <remove_ridimz@remove_yahoo.com> wrote:

> I would like to request permission to tag along IOT learn about Operating System development.

Hi, what's IOT?

> What would I need and what are some locations I can turn to for resources and guiance?

Some links are:

http://www.operating-system.org
http://www.osdev.org
http://newos.sourceforge.net

Robert
February 25, 2004
In article <opr3xj38p9heztw6@news.digitalmars.com>, =?iso-8859-1?Q?Robert_M._M=FCnch?= says...
>
>On Tue, 24 Feb 2004 20:11:21 -0500, Andrew Edwards <remove_ridimz@remove_yahoo.com> wrote:
>
>> I would like to request permission to tag along IOT learn about Operating System development.
>
>Hi, what's IOT?
>

in order to

>> What would I need and what are some locations I can turn to for resources and guiance?
>
>Some links are:
>
>http://www.operating-system.org
>http://www.osdev.org
>http://newos.sourceforge.net
>
>Robert

Thanks