What causes page fault and how to minimize them?

18,886

Solution 1

http://en.wikipedia.org/wiki/Page_fault

Increasing the physical RAM on your machine could result in fewer page faults, although design changes to your application will do much better than adding RAM. In general, having a smaller memory footprint, and having things that will often be accessed around the same time be on the same page will decrease the number of page faults. It can, also, be helpful to try to do everything you can with some bit of data in memory all at once so that you don't need to access it many different times, which may cause page faults (aka thrashing).

Solution 2

It might also be helpful to make sure that memory that is accessed after each other is near to each other (eg if you have some objects, place them in an array) if these objects have lots of data that is very infrequently used, place it in another class and make the first class have a reference to the second one. This way you will use less memory most of the time.

Share:
18,886
Sousou
Author by

Sousou

Updated on June 20, 2022

Comments

  • Sousou
    Sousou almost 2 years

    When examining a process in Process Explorer, what does it mean when there are several page faults? The application is processing quite a bit of data and the UI is not very responsive. Are there optimizations to the code that could reduce or eliminate page faults? Would increasing the physical RAM of the system make a difference?

  • Brett Widmeier
    Brett Widmeier about 14 years
    +1: While this is a pattern I was well-aware of in database design, I had never really considered it for OO-design. I like it!