A Few Questions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chris

A Few Questions

Post 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?
Jamethiel

Re:A Few Questions

Post 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...
zloba

Re:A Few Questions

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:A Few Questions

Post 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 ...
chris

Re:A Few Questions

Post by chris »

Well that cleared that up :) Thanks.
chris

Re:A Few Questions

Post 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
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:A Few Questions

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:28 pm, edited 1 time in total.
chris

Re:A Few Questions

Post by chris »

I will have at those sites, thanks Perica
Post Reply