PDA

View Full Version : page faults



moowy
19th January 2007, 01:45
Hi,

i'm writing a paper on page faulting and I need some help if you can help me:
I need to know how can a programmer effect (influence) page faults. What data structure can we use (and how do they effect page faulting). Let's say we have hash table and the decreases localness (array increases local) and what does that mean in page faulting.
How does the compiler fit into all this?? Does c++ have any special treatment for this page fault handling(maybe if you have an example)??

I'm sorry if my english is a little bad... Thanks for all your help.

e8johan
19th January 2007, 08:09
The beauty of C and C++ is that you can translate them almost in a one to one manner into assembly. This means that there is no treatment for page faults (what I would call cache page misses, faults indicate that something is wrong). However, some compilers do pay attention to this issue - Patterson and Hennesay mention this in one of their computer architecture books.

As you say with locality - it increases the cache efficiency. So if you reduce it you reduce the efficiency. Pretty obvious that this affects programs regardless of what language was used for development.

Something that can be interesting is that modern processors have a huge problem with memory bandwidth. And that just gets worse when we get multi-core and hyper-threading chips. In these situations it is sometimes more efficient to re-calculate values than storing them in memory for later. This invalidates the good old optimization rule to take stuff out of the inner loop.

moowy
20th January 2007, 15:13
Thanks. I finished my paper today (and I used some of the stuff u wrote) :)