[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [f-cpu] Do we really need virtual memory?


Beat Steiner wrote:

The question might be stupid, but I ask it anyway:
Do we need virtual memory?
it depends on whether you mean "we" = "I" or not.
if you think that VM is pointless, just drop it.
however, as F-CPU is meant to be a workstation-class CPU,
virtual memory addressing to hardware memory addressing mapping
is doubtlessly necessary.

In a huge address space,
every program could be physical memory aware.
but, you know, programs "have a life" (they grow, shrink, etc)
and they might want to allocate more memor than physically available.

In an embedded system, it might make sense to tune the whole
software (OS+application) in order to limit the required memory
to the available SDRAM and use ucLinux for example.

But when you want to execute desktop-class or server-class
applications, you can't drop the virtual memory.

The only case I see now that VM makes sense is memory fragmentation:
Example: I need to expand a memory block, but there is already one allocated
next to it. VM could map the new block from anywhere to the adjacent address...
With VM, we save the work of moving around the memory block to be enlarged.
hmmm you start to see the light ;-)

Any further examples welcome.
malloc() a huge area and only access some sparse elements from time to time.
without VM, your allocated memory must be smaller than
SDRAM size - already allocated memory.
with VM, you are not limited, so you can physically allocate a memory
page on first access and  swap the unused pages, at the cost of VM traps
(page faults triggered by unallocated pages or pages that are swpped out).

Getting rid of VM would simplify the "TLB" (only permission checks) and
significantly reduce its footprint.We may get rid of VM for the FC0 only and add it again later.
the first "working" versions of FC0 are do not necessary implement the TLB,
it will come around F-CPU v0.7 or 0.8.


To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/