Post by Vir CampestrisPost by Johnny BillquistPost by Vir CampestrisThanks all for the pointers. I'll have a look when I get time. Which
ought to be in May, when I've retired!
Off-chip memory manager - well, you all know that when the '286 came
out it was an attempt to get a bigger address space on top of the
8086 which was limited to 1MB.
Except Intel did it in such a way almost nobody could use it. OS/2
was about the only one I know of, and that wouldn't really run 8086
programmes.
What we did was to take the top address bits and use them to index
into a fast RAM; the output of the RAM became new address bits.
More address bits.
Which means that within the scope of one process you have the full
1MB address space of the 8086, but the computer can run more than one
process, each with their own address space. You can even do proper
paging if you want. Sadly virtual addressing wasn't possible; there
was no way to restart the current instruction after a page fault.
If you can't restart an instruction, you can't do paging. You'll have
to swap all memory in before execution, so no page faults happen.
Virtual memory is fine though (I think you reversed what paging and
virtual memory is :-) ).
I think we're disagreeing on terminology.
Very likely. But I'll do one attempt at "converting" you. :-)
Post by Vir CampestrisYou can have lots of pages on a '286 with the MMU we built. What you
can't have is a page fault. Which means you can't have virtual memory -
everything the app needs must be in real RAM all the time.
Pages basically means the virtual memory is not necessarily all
contiguous in physical memory. I think we can agree on that part. It
also means that you can have a setup where not all of your virtual
memory are mapped somewhere into physical memory at some point in time.
Paging is the action of reading in a page after a page fault. A page
fault happens when a page is not resident in memory.
I do think we can agree on things so far. Possibly you might have some
other definition of what paging is, which would be interesting to hear,
since you think you can do paging.
But the usual definition of paging is that you read/write individual
pages as needed. Which is different than swapping, which is dealing with
all the process memory in one go. With swapping you are either in
memory, or not. You swap a whole process in or out. You don't swap
individual pages. Then we're back to paging again. But even when you
have pages, swapping as such can take place. Nothing says that swapping
cannot be done on an address space that is divided into pages.
Now, virtual memory is a completely different thing. Virtual memory is,
as the name suggest, memory which is virtual, ie. not real/physical. And
it's not real in the sense that the address space your program have
might have an address 0, and you might have some data there. Another
process might also have an address 0, and some data there. But this is
not the same address 0, and it's not the same data. Both processes
thinks they have a bunch of memory which is their own, and it acts like
memory, and can be used. But in the actual machine, there is just
physical memory, and there is an address 0, but it's not the address, or
the data either of these processes are thinking about, referring to, or
using. Each process have its own virtual memory. From time to time, that
virtual memory might map to physical memory, but that might not always
be the case. Further, the actual physical memory address used for
virtual 0 might be anything. And for each process, virtual 0 might map
to a different physical address.
But the point is, from the process point of view, it appears that he has
a full address space with memory, and it's his alone, he can do anything
in there, and it's completely isolated, and the address space as such is
private. He might not even see the OS memory, even though it obviously
also do exist.
The size of physical memory compared to virtual memory is actually
irrelevant. However, if you want to have more virtual memory than there
is physical memory, not only do you need virtual memory, but you also
need paging. Because without paging, you cannot exceed physical memory.
But you can still have virtual memory.
In you head, I bet you are thinking that virtual memory means paging.
But as you observed yourself, you cannot even have page faults if you
can't restart instructions, so at that point your process cannot have
more virtual memory than physical memory. Does that then mean you
actually do not have virtual memory either. You obviously do not have
page faults. What does "paging" mean for you then?
And to make some practical examples: the PDP-11 have a 16 bit virtual
address space, but a 22-bit physical address space. It divides the
16-bit address space into 8 pages, and you can even restart
instructions. So in theory you could do a system with paging, but as far
as I know, none have been done. However, you do have virtual addressing,
and virtual memory in pretty much all operating systems that are
multiuser ones. (They all just do swapping. But total memory used by all
processes might easily exceed the available physical memory, but a
single process have to have all it's memory in physical space before
executing. I could go into more details why this is, if anyone is
interested.)
But in your view then, do the PDP-11 have or not have virtual memory?
Would it change if you were to implement demand paging? Or will it never
have virtual memory, no matter what, just because of the basic fact that
it has a larger physical address space than virtual? After all, apart
from that detail, it would be doing exactly the same thing as another
computer you would claim do have virtual memory.
Similar on VAX. The original VAX had a 32-bit virtual address space, but
a 30-bit physical one. So you would think/argue that this machine then
have virtual memory, as well as paging (well, not all operating systems
on the VAX did paging. Classical example is the first Unix port, which
only did swapping on the VAX, and did not do any demand paging - did it
not have virtual memory then?). However, the last revision to the VAX
architecture allowed the physical address space to go up to 34 bits. So
in theory you could then see a machine with more physical memory than
virtual memory could address. Does this then mean that the VAX no longer
have virtual memory? Because of that extension? Or would it just stop
having virtual memory the moment you actually inserted that much
physical memory?
Sorry for such a long post. It's just that it always bothers me when
people use virtual memory for a term that is paging, and think that
virtual memory can only exist if the virtual address space is larger
than the physical address space. It leads to funny and strange
conclusions, and redefinition of machines in some situations, as well as
disagreeing with age old documented usage of the terms. Check any PDP-11
processor handbook for virtual addresses. It's in there.
Post by Vir CampestrisPost by Johnny BillquistBut yeah, I think pretty much noone every used the 286 much, for these
reasons.
And we used it just as a faster 8086.
Yeah. That might have been a popular use. :-D
Johnny