Best memory manager

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
reload
Posts: 9
Joined: Sun Jul 12, 2015 10:15 am

Best memory manager

Post by reload »

Good morning! Which is the best way to manage memory? If here a good example? Is paging the best variant?
....
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Best memory manager

Post by Combuster »

Considering you mentioned paging, you're looking for virtual memory management? If so, paging is in most cases the correct answer. At least it is good practice to get used to the basics before you worry about intricacies.

(And as long as you appear not to have read all the relevant wiki pages, there's little more to talk about.)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Best memory manager

Post by onlyonemac »

I've been researching memory management, and the best way to get started is to implement a physical memory manager to allocate physical blocks of memory (usually one page (4kb) in size) and a virtual memory manager to map those blocks to the virtual address space for each process/thread. I'm still working out the details, but keeping a bitmap of physical memory blocks is a good starting point (and not bad for continued use; if you prefer it's always quite easy to change something like that later if you keep your code properly modulerised) and having a page directory block for each process/thread is likely to get you quite far with changing the virtual address space on a context switch.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Post Reply