Page 1 of 1

A Few Questions

Posted: Mon Dec 29, 2003 1:50 pm
by chris
Here's a few silly questions I still don't know the answer to :(

1. What is the "heap" ?

2. Will your memory manager only come in to use once you have a linkage loader so you can actualy load programs into memory and execute them?

Re:A Few Questions

Posted: Mon Dec 29, 2003 2:09 pm
by Jamethiel
chris wrote: 1. What is the "heap" ?
It's a pile of stuff.

In a more technical context, it's an area of memory that is used to satisfy allocation requests. For a more detailed explanation, feel free to read the source to malloc(3) or the books Windows Internals or Windows 95 System Programming Secrets. Or any discussion of application-level (as opposed to system-level) memory management.
2. Will your memory manager only come in to use once you have a linkage loader so you can actualy load programs into memory and execute them?
I don't know about other people, but my memory manager will be an integral part of the system, to the point where device drivers will have to be carefully written -not- to use it.

At least, that's the plan. Not like I have much time right now for follow-through...

Re:A Few Questions

Posted: Mon Dec 29, 2003 2:12 pm
by zloba
1. What is the "heap" ?
a mechanism for dynamically allocating and freeing chunks of memory on demand of the program, like what is returned by "new" operator and malloc()
the heap allocator requests large blocks of memory from the operating system, breaks them up into smaller chunks of the requested size and returns the address of a chunk.

Re:A Few Questions

Posted: Mon Dec 29, 2003 2:13 pm
by Pype.Clicker
the "heap" is the name given to the memory area that can be used for dynamic allocation. malloc, the C++ and pascal new operators return references on data structure that are on the heap, which means their lifetime is not bound to a specific function call, but that their existence needn't to be forseen at compile-time.

This is very convenient when you have to handle variable-sized containers like lists, vectors, trees, etc.

I wouldn't recommend to postpone the devlopment of the dynamic memory manager until you start loading programs in a modern OS, because there will be many structures (process list, sleeping threads, pending timers, etc) that you'll have to deal with *before* you actually start loading programs and which will have to be dynamic once you'll start running user programs.

It's just like making the system thread-safe before you have many threads: it sounds silly, but once you add the second thread, the code is ready to deal with it ...

Re:A Few Questions

Posted: Mon Dec 29, 2003 3:58 pm
by chris
Well that cleared that up :) Thanks.

Re:A Few Questions

Posted: Mon Dec 29, 2003 10:11 pm
by chris
Hmm, two other quick questions ;D

Whats the difference between iret and iretd; and popad and pushad?

*and*

In the multiboot_info struct in the multiboot.h for GRUB, what does mem_upper and mem_lower represent? Is it the top and bottom of the physical memory? How can I use this to determine the physical memory size?

Thanks ;D

Re:A Few Questions

Posted: Tue Dec 30, 2003 12:06 am
by Perica
..

Re:A Few Questions

Posted: Tue Dec 30, 2003 9:58 am
by chris
I will have at those sites, thanks Perica