Re: How does a processor generate an address?



Mary wrote On 09/27/05 12:56,:
> First of all, thank you very much for your reply. Your explantion about
> the illusion of a larger memory was very helpful. I definitely haven't
> got my fundamentals right.
>
> You mentioned "the memory address presented on the address bus by the
> processor". Where does that memory address come from?
>
> Also is the following assumption correct? There is VM and Physical
> memory. And as fas as I understand, these are located at different
> addresses, and are independent of eachother. A program only runs from
> Physical memory.

Virtual memory is like a card game. The operating system has cards (pages),
which on the back say "physical page 6", and on the front say "virtual
page 10". The processor can lay the cards out in rows and collumns to make
a large surface for the program to run on, or it can get even more tricky
and only place cards where the program needs them.

Each time the program needs a page of virtual memory, say at address
$10000000, the OS gets a card or page from its stack of physical pages.
Lets say the next page of physical is $12340000. Then it sets that page
to be virtual $1000000, and places the page in the "working set" of the
program, and thus it now has its virtual memory.

How does the program request this memory ? It accesses it, by reading,
writing, or even executing instructions from it.

Now thats virtual addressing. Virtual memory is slightly more than that.
The operating system can use this ability to do very interesting things.
It can start out with no cards on the table for the program, then
let the program determine what cards it wants. The program only gets
pages if it specifically asks for it. This is called "demand paging".

Now, the OS is watching the program fill the table with cards, it can
then say "gee, the program asked for card X, but hasn't used it for
quite some time". It can take the card off the table, knowing that it
can simply put it right back if the program asks for it. If the card
has data the program created, it can move the card off to a hard disk
so that it can get the data back. If the card contains, say, part of
the program's instructions, and the program was not allowed to write
on it (modify its own code), it can just throw the card away, knowing
that it can just get that card back from the program file on disk.

What is important to understand is that the program is not aware of
any of this. If it hits a page that is not there, it is stopped cold
until the page is placed there by the OS. Its as if your company
got really cheap with furniture, and fitted you with a device that
made you zone out whenever you tried to sit in your office chair and
ring a bell. When it happens, someone runs down the hall, takes a
chair that is not currently in use, and places it under you, and
lets you go. You are not aware of any of it, you think you have a
chair of your own, unless you notice the clock on your wall seems
to jump ahead on occasion.

>
> Say for example, you have Physical memory starting at address
> 0x8000_0000 (512MB of it), ending at 0x9FFF_FFFF. Then there is VM
> starting at 0xA000_0000 ending at 0xBFFF_FFFF. If I have a program and
> I make it start at 0x8000_0000, I still don't see how the processor
> generates any virtual address.
>
> Mary
>

You're thinking of VM as a thing that does not change. VM is your
programs *view* of physical memory that the OS arranges for you.
If you ask (your program asks) for memory at $80000000, then the OS
arranges for you to have it there, by taking real physical memory and
placing it there for you.

.



Relevant Pages

  • Re: Is there a guide to upgrading options?
    ... >it will cost to upgrade my system. ... - Video card. ... the cheapest 2 x 256MB memory pack with a brand name and warranty. ... Since the motherboard I selected has dual-channel memory it is best to ...
    (comp.sys.ibm.pc.hardware.chips)
  • Re: virtual memory
    ... you can have virtual memory ... that software transparent swapping requires virtual memory. ... (since swapping it into physical memory is all or nothing). ...
    (comp.arch.embedded)
  • Re: display memory extra
    ... card has 64MB video RAM, ... but not actual display memory itself...but that's just a guess there, ... actually wasn't as expected...and is why Windows still - on the ... via the device driver...and via the device driver _only_... ...
    (alt.lang.asm)
  • Re: Why is VS 2005 so slow?
    ... You are confusing physical memory with virtual memory. ... Note also that the number of apps you can run at the same time doesn't change. ...
    (microsoft.public.vc.mfc)
  • new laptop for sale
    ... layer DVD drive ... card with up to 256 MB of shared memory ... Pre-installed with Windows Vista Home Premium (with Media Center ...
    (comp.periphs.printers)