Page 1 of 2

Virtual paging?

Posted: Thu Nov 17, 2005 1:45 pm
by Kemp
Something occured to me. On current "64-bit" systems the available memory space is a lot bigger than the 4Gb a program is allowed to use. Does this open the way for paging memory out to other memory areas? Essentially the same operation as paging to a hard drive but much much faster going in and out. Would be relatively simply to remap memory to just include the source and destination, copy, and then switch back to the application's memory space. Of course, I'm assuming this is a case where an app needs more than the (4Gb - OSSpace) that is available, if you manage to go over physical memory it'd obviously still be back to disk paging.

Re:Virtual paging?

Posted: Thu Nov 17, 2005 3:11 pm
by Colonel Kernel
Wouldn't it be easier to just port apps to use 64-bit pointers and thereby use more of the address space...?

Re:Virtual paging?

Posted: Thu Nov 17, 2005 3:18 pm
by JoeKayzA
Kemp wrote: Essentially the same operation as paging to a hard drive but much much faster going in and out.
I can't see how this is similar to paging memory out to disk, I mean, when you do swapping, the app itself won't notice that a page has been swapped out - the virtual page is still there. When it is accessed then, the OS has to fetch it back from disk and make it accessible - again the app won't notice.

When you want to reuse virtual pages (when the app needs more than 4Gb of address space), the app itself will have to notify the OS when it wants to swap a page, so that's an entirely different thing to me.

And, btw, I would also say that an app which needs more virtual memory than the OS can provide in 32bit mode should be ported to run in 64bit mode. Especially when it relies on a 64bit OS to run underneath.

cheers Joe

Re:Virtual paging?

Posted: Thu Nov 17, 2005 3:33 pm
by JAAman
it wouldn't be paged: the pages (while in physical memory) can be located anywhere in physical memory -- you can't 'page' out to ram because if its in ram its accessable (and therefore unswapped)

you can have several apps entirely within physical memory (in 32bit mode under a 32bit OS) if you have enough physical memory: pages can be mapped anywhere -- not just to a 4GB block at bottom_of_mem

if an app needs more than the availible virtual address space, most OSs (incl. windows, and, eventually, JaaOS), allow it to swap out portions of its address space this normally is swapped to disk but i would imagine that it could be done within physical memory -- but you would need to set up a method of tracking it since it would not exist within any address space (however i will be creating a special class of address spaces that contain 'overflow' from another address space)

-- note this technique of swapping virtual memory (to enlarge an address space) is normally called 'banking' not 'paging' (which normally refers to swapping physical memory -- to increase physical memory)

Re:Virtual paging?

Posted: Thu Nov 17, 2005 3:52 pm
by Kemp
Yeah, the intention wasn't that you should fixate on the term 'paging', I just used that as it was the closest analogy I come think of off the top of my head.

The last I heard was that even under 64-bit mode a single virtual address space could only be 4Gb maximum still. Obviously if I heard wrong then this discussion is kinda moot.

Re:Virtual paging?

Posted: Thu Nov 17, 2005 4:09 pm
by JAAman
no, under LMode, your address space is much larger
however this is still valid question under PMode, as any CPU in the last 10 years can support up to 64GB ram (and the newer ones allow 1TB -- even in PMode)

this has been a common technique as far back as RMode programs running under DOS can use more than the RMode limit, using banking (where a 64KB (or smaller) block of data/code is 'swapped' to extended memory (through an extended memory manager) and then can be restored later, to increase the total memory availible within a true RMode environment

there was even a standardized driver for this (which worked with both extended and expanded memory depending on which was installed and the application didn't even need to know which was being used) the most popular of which is emm386 (because it came bundled with most computers -- bundled with both DOS and win3)

Re:Virtual paging?

Posted: Thu Nov 17, 2005 4:42 pm
by Candy
Kemp wrote: Yeah, the intention wasn't that you should fixate on the term 'paging', I just used that as it was the closest analogy I come think of off the top of my head.

The last I heard was that even under 64-bit mode a single virtual address space could only be 4Gb maximum still. Obviously if I heard wrong then this discussion is kinda moot.
You heard that wrong. An address space is at least 40 bits (1024 GB), and iirc it was 48 bits (262144GB) in all AMD implementations of AMD64.

Re:Virtual paging?

Posted: Fri Nov 18, 2005 4:49 am
by Kemp
Hmmm.... must have been a communication issue somewhere along the line then. I'll see if I can find the threads where I remember reading it, see if I accidently took something out of context.

Re:Virtual paging?

Posted: Fri Nov 18, 2005 9:17 am
by JAAman
or get an updated copy of the holy bible intel manuals

Re:Virtual paging?

Posted: Sun Nov 20, 2005 1:10 pm
by Candy
JAAman wrote: or get an updated copy of the holy bible intel manuals
*cough* for AMD64, you might just want the AMD manuals.

Re:Virtual paging?

Posted: Sun Nov 20, 2005 2:31 pm
by Brendan
Hi,
Candy wrote:*cough* for AMD64, you might just want the AMD manuals.
Does AMD actually have proper programmer's manuals? All I've seen are documents that describe differences between AMD CPUs and the Intel manuals (e.g. 3DNOW extensions, AMD64 extensions, CPU datasheets, BIOS developers manuals, optimization, etc)...


Cheers,

Brendan

Re:Virtual paging?

Posted: Sun Nov 20, 2005 3:16 pm
by Candy
Brendan wrote: Hi,
Candy wrote:*cough* for AMD64, you might just want the AMD manuals.
Does AMD actually have proper programmer's manuals? All I've seen are documents that describe differences between AMD CPUs and the Intel manuals (e.g. 3DNOW extensions, AMD64 extensions, CPU datasheets, BIOS developers manuals, optimization, etc)...
Yes. See image for proof (picture of my own hardcopy).

Re:Virtual paging?

Posted: Sun Nov 20, 2005 3:22 pm
by Candy
For links: Volume 1, Volume 2, Volume 3, Volume 4, Volume 5.

The photo is of volume two, which is of course the System Programming manual. The picture was taken with my telephone on night mode, which of course doesn't give a very good image. You should still be able to recognise it.

Let's add the pacifica virtualization manual to the list.

[edit] you can't add an image in modify? that's wrong. [/edit]

Re:Virtual paging?

Posted: Mon Nov 21, 2005 2:42 am
by bubach
Where did you get a hardcopy? You didn't go to USA or Canada just to order one, did you? ;D

Re:Virtual paging?

Posted: Mon Nov 21, 2005 2:46 am
by Candy
bubach wrote: Where did you get a hardcopy? You didn't go to USA or Canada just to order one, did you? ;D
* Available only in the US and Canada.
International users, please download the documents
Just be an arse and fill in Saskatchewan, Canada and put in the comment field "NOT SASKATCHEWAN BUT HOLLAND, EUROPE" with full address. Does increase the delivery time though... mine took 3 months...