Memory Management

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
chrisa128

Memory Management

Post by chrisa128 »

Hi all,

I have just started work on my Process Manager and Memory Manager. I am using paging and have a few questions...

1. I want to be able to track all the pages used by one resource, do I need two seperate structures

2. I also need to be able to set access rights on that area of memory individaul of the ring, do I need another structure for this?

3. I also want to know what method you would use for allocation as I am currently thinking of Best Fit?

Thanks
Tim

Re:Memory Management

Post by Tim »

chrisa128 wrote:1. I want to be able to track all the pages used by one resource, do I need two seperate structures
What do you mean by 'resource'? Where does the number 2 come from?
2. I also need to be able to set access rights on that area of memory individaul of the ring, do I need another structure for this?
Not necessarily; all protection is encoded in the GDT and page tables. However, if you want to start implementing virtual memory, you'll need to store this information yourself.
3. I also want to know what method you would use for allocation as I am currently thinking of Best Fit?
Best fit works, as do first fit and worst fit. Try each of them, do some tests, and pick the one you like best. Or pick the one that's easiest and cleanest to implement. Leave enough room in your design that you're able to change algorithms easily.
chrisa128

Re:Memory Management

Post by chrisa128 »

Quote from: chrisa128 on 05-Mar-03, 03:46pm 1. I want to be able to track all the pages used by one resource, do I need two seperate structures

What do you mean by 'resource'? Where does the number 2 come from?
I mean that if I set up a structure to map the pagetables, do I also need a structure that points to this for my Virtual Memory?
Tim

Re:Memory Management

Post by Tim »

I think that depends on how you work out your design.

My design consists of:
-- a vm_node_t for each range of addresses in one address space, each of which points to:
-- a vm_area_t structure for each block of memory (memory can be shared, so more than one vm_node_t can refer to one vm_area_t). This contains an array of:
-- addr_t, which specify the physical addresses of any pages committed within the memory area.
Post Reply