Real vs. Virtual vs. Physical (Was: Designing around a 6502 (was Re: Assembly on a Apple IIc+))

From: Hans Franke <Hans.Franke_at_mch20.sbs.de>
Date: Wed Feb 12 13:22:44 2003

> > (*1) Often the term real memory is used, but that's
> > not correct. Physical memory is the memory installed
> > in a machine, while real address space is the addressable
> > amount of RAM by a CPU without using virtual addressing.
> > Virtual address space can never excede real address space
> > (After all, it's the maximum address range generated by
> > the (logical) CPU), while physical memory can go beyond
> > real or virual address space.

> Virtual address space *can* exceed physical address space---the 80386 (and
> therefore, on topic) is a good example.

Err... rereading my paragraph, I can't see anything wrong.
I didn't say Virtual can not exceede Physical. Of course it
can. Just to make it clear:

Physical is the amount of memory installed, or installable.
Real is the address space addressable by a CPU.
Virtual is the address space addressable before translateing.

The first thing is that we are here talking about two things.
Installed Memory and Address Space. Second, for most CPUs
virtual and real address space are the same. Let's use a
6502 as example. The CPU has an address space of 2^16, which
is the real address space. Now if we add a MMU, which translates
the upper 4 bits into 8 bits of page addresses (each page 4k
in size) we get a maximum physical address space of 1 MB, while
the real address space is still 64k - and so is the virtual.

> A segmented architecture, the
> segment registers use 14 bits [1] as an index into a table giving the
> physical address, while each segment can be 4G in size. 14+32 gives you a
> 46-bit logical address, meaning you can virtually address 64 terrabytes in
> the whole system; a bit more than just the 4G physical address space the
> chip puts out.

Now, here we have a virtual address space larger than the real.
There is no statement about the physical. all we can say is
that the physical (without any other mean of external address
translation) if equal or lower than 2^32 (4G).

The whole distinction between physical, and real/virtual was
did become necersary when suddenly machines had more memory
than they could address with real or virtual addressing.

In fact, the 286 would have been the right example here. it
could address 16M physical, while real and virtual addressing
was still limited to 64K or 1 MB.

> -spc (And attempting to use all 64TB would probably cosume huge amounts
> of physical RAM just for the lookup tables ... )

Nop. you always have only a maximum of 2^13 descriptors.
no mater how big the segments are. So if you use all
8192 Entries, the table is just 64K ... Nice value :)
IIRC a entry has 8 bytes, containing base, limit, type, privs.

So nom matter if you used a physical memory of 1 MB, or
4 GB, each descriptor table could only grow up to 64k.
Hmm... oh, yes, there have been more tables: Local,
Global, Task... Still, it comes up to a maximum of 256K.

Gruss
H.

--
VCF Europa 4.0 am 03./04. Mai 2003 in Muenchen
http://www.vcfe.org/
Received on Wed Feb 12 2003 - 13:22:44 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:35:54 BST