flat assembler
Message board for the users of flat assembler.

Index > Main > Does paging slow down memory access?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17635
Location: In your JS exploiting you and your system
revolution
Some simple facts:

If the requested page is already cached in the TLB then there is no slowdown.

If the requested page is not already cached in the TLB then there can be a large delay while the entry is fetched and checked for privilege accesses.

And depending upon your usage case you can work out how many times you need to rebuild TLB entries and thus how much of a slowdown your might experience in your real world app. But in reality this is hard to do accurately, so the easiest way to find out for real is just to test it. Write two versions of you app and see if the speed difference is noticeable or significant enough to you.
Post 24 Oct 2010, 23:02
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Quote:
ouadji:

paging is hardware and does not slow down memory access

(I was not talking if the page isn't in the TBL ... In this case, yes, it's obvious)
Quote:
revolution:

If the requested page is already cached in the TLB then there is no slowdown.
thank you revolution.
this is normal, this mechanism is fully hardware

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 24 Oct 2010, 23:56
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17635
Location: In your JS exploiting you and your system
revolution
You must also consider the design of your OS. If your app needs to have contiguous RAM then paging can significantly improve overall speed. It is far quicker to build page table entries to add more RAM to an existing allocation than it is to have to copy the contents of RAM to other places to make enough space to keep the allocation contiguous.

As usual, this is a trade-off, and it depends upon what your app is actually doing.
Post 25 Oct 2010, 01:42
View user's profile Send private message Visit poster's website Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 294
Alphonso
FWIW I did some RAM benchmarks (3rd party) on non PAE 32-bit, PAE 32-bit and 64-bit some time ago. The non-PAE 32-bit showed the best memory latencies ~1% better IIRC than the others (less to look up I guess). Could not test no paging though but if someone comes up with a test program I would be happy to give it a try.
Post 25 Oct 2010, 05:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7782
Location: Kraków, Poland
Tomasz Grysztar
Something from the documentation of PMODE/W (this was an open-source DOS extender, from which I was learning basics of protected mode back in the 90's):
Quote:
In addition, under a clean or XMS system, paging will not be enabled. This is only a minor speed increase, but there is no real need to manage paging.
So, even on early 32-bit processors the speed increase from disabled paging was only minor (though existing).
Post 25 Oct 2010, 05:20
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
one more argument to don't use paging in an intessive random memory access program:
using paging consumes more energy because it uses additional circuitry.

save the planet!! Smile
Post 25 Oct 2010, 09:55
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 707
Location: Adelaide
sinsi
In the days of DOS on a 486 I remember quite a few games that would crawl if emm386 was loaded, maybe due to paging?
Post 25 Oct 2010, 10:03
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
Tomasz Grysztar wrote:
Something from the documentation of PMODE/W (this was an open-source DOS extender, from which I was learning basics of protected mode back in the 90's):
Quote:
In addition, under a clean or XMS system, paging will not be enabled. This is only a minor speed increase, but there is no real need to manage paging.
So, even on early 32-bit processors the speed increase from disabled paging was only minor (though existing).


on a very large scale, like 40 days of computing, a minor speed increase is not negligeable. it can easy lead to extra hours or minutes.

exactlly like ppm in chemical industry, centimeters of wire (VS meters) in electronics, grams of matter in car manufactures, etc... that leads to thousands dollars if applied on large series.
Post 25 Oct 2010, 10:28
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
sinsi wrote:
In the days of DOS on a 486 I remember quite a few games that would crawl if emm386 was loaded, maybe due to paging?
Probably not because of paging, but rather the overhead of running in VM86.

edfed wrote:
on a very large scale, like 40 days of computing, a minor speed increase is not negligeable. it can easy lead to extra hours or minutes.
A couple of minutes saved over the course of a month are pretty insignificant - and we don't even know if the paging overhead is that big (I doubt it is). 5 minutes of 30 days = 0,0116%.

_________________
Image - carpe noctem
Post 25 Oct 2010, 11:15
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3025
Location: vpcmipstrm
bitRAKE
IIRC, there are several tricks in the OS to minimize INVLPG use (cannot recall the exact presentation). Efficient page table organization also helps: use of large pages for example. Unfortunately, (the idea of) security trumps efficiency in Windows.
Post 28 Oct 2010, 03:04
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
what is sure is that paging can be used as part of an algorythm.
for example, shifting, exchanging, adding several 4096 bytes arrays.

if the representation of a 4096 * 4096 array uses paging to manipulate collumns and rows, it will increase significantlly the speed of the global algo.
and needs (16k + 4) * 4096 bytes (64 MB) to hold the paging structure of one 4096*4096 array.

it will only act on virtual adressing, but from a program point of view, it will be a real data exchanging or shortcut, only using a couple of instructions to move these datas.

then, paging can speed up a lot assuming you need array computations, even if you need to reload the entire TLB.
Post 28 Oct 2010, 10:36
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.