This is part one of a mini series on how Windows manages system memory
and how it is relevant to users of memory intensive applications like
SolidWorks.
The most common utility used to monitor process and system memory is Task Manager. There are two problems with that:
a. In the default view that comes up, we see just one memory metric;
that metric does not fully reflect how a process is using memory and
b. In the Windows XP version of Task Manager, the default column is "Mem Usage". In Vista, it is "Memory (Private Working Set)".
What is the "Working Set?" Simply put, Working Set is the amount of memory a process is using that is backed by actual physical RAM.
Let me try and explain these terms with an analogy:
Four people [processes] - Andy, Bob, Colin and Dave - are writing books (independently, no collaboration). They are sitting at the same table [physical RAM].
Each of them need to lay out papers (let's call them papers to avoid
confusion with memory pages) that they write on the table [Working Set]
to refer to them. Each person's need of number of papers - total and on
the table at one time - is different depending on the complexity of the
book [memory requirement]. Andy, for example is working on a
detective story so he needs to keep track of more characters and put
more papers on the table than Dave who is writing a children's story.
The space on the table is limited (just like RAM), so a common filing cabinet [Paging System]
is provided where each person can store his papers temporarily if the
space on the table runs out. But that cabinet is away from the table, so each person has to get up from the table and walk over to use it
[Page Fault]. This slows the person down, so each person is
going to want to have as many of his papers on the table as possible.
There can fit only so many papers on the table at once, so there
is a supervisor [Windows Memory Manager or WMM] - let's
call him Steve - who is watching over the table to make sure nobody
gets into a fight and starts putting his papers on top of each other's [memory overwrites across processes].
Now let's say there are some common things on some papers that each
person is handling, e.g. some Andy's and Bob's papers have the same
header, and Bob's and Colin's papers have the same address label. The
supervisor sees this and says instead of Andy and Bob each having a
paper having partly identical data and wasting space on the table, I'm
going to tear out the header from Bob's paper and tell him to use the
header on Andy's paper for reference; same thing for Bob and Colin [Shared Working Set].
This will save some space on the table depending on how many duplicate
headers / address labels there are at any given time. The unique
contents on each person's paper are left alone [Private Working Set].
Colin gets up and says he's going on a coffee break [application is minimized].
The supervisor, Steve, looks at what Colin was working on. He sees
Colin had 10 papers on the table, but was working actively on only 2 of
them. So he gathers up the remaining 8 and puts them in the cabinet [trims Colin's Working Set]. This gives the other people more room at the table to put their own papers there.
Next Edwin [sldworks.exe] walks in the door with a huge pile of
papers - he is writing a serious novel with a lot of multiple
characters and parallel story lines. Steve sees this and says - okay
everyone, I'm going to clear as much space on the table for Edwin now.
Steve puts away a lot of papers from the table into the cabinet and
Edwin sits down and starts working. Dave doesn't mind having just one
paper on the table, his children's story is simple. But Andy is
stressed out - he has 8 papers on the table for his detective story but
still finds himself running back and forth to the cabinet to refer to
his earlier papers [Page Faulting], so he gets really slowed
down. Edwin is not doing so well either - he would rather have everyone
else go away, so he can use the full table. Steve has no control over
that; he's doing the best he can. But Steve's manager [you, the user] hears this stress going on with everyone in the room running back and forth [the hard disk thrashing with page faults] so you order everyone but Edwin out of the room [kill all other processes].
Edwin now has almost the entire table to himself. Almost. Steve also uses space on the table for his own bookkeeping [OS processes]. In addition, Steve uses up half of everyone's paper for his own bookkeeping [kernel address space] ! Edwin soon starts running out of paper as his novel gets larger and larger. Steve's manager [you] tells Steve - can you please give Edwin more space from your bookkeeping papers? He needs more paper [/3GB switch]. Steve does so and Edwin starts working again.
If Steve's manager still hears the noise of footsteps coming from the
room, he can guess who the cause is and how he can fix it - by getting
a bigger table [adding more RAM], so Edwin doesn't have to go
the cabinet so often. But there is a limit - Steve's manager now wants
Edwin to write a trilogy of novels [load massive assemblies], he needs to get a bigger room which can fit a much bigger table so Edwin can work more efficiently [move to x64].
I've stretched the analogy long enough. How is all this
relevant to a SolidWorks user? To go back to our original Task Manager
snapshots - "Mem Usage" in XP is the Total Working Set
(sum of Private WS and Shared WS) of the process. That's why it looks
like explorer.exe is taking less memory in Vista than XP. It's not true - you're actually looking at two different metrics! To compare apples
to apples, go to View->Select Columns...->Check "Memory - Working Set" and then compare Vista with XP.
If you are interested in getting more information about your system and processes, Process Explorer
is a much better utility than Task Manager to get the data with the correct
terminology. It can also show other metrics and resources such as Page
Faults per second, disk I/O activity, network activity, etc. in
addition to all the memory metrics explained above.
Next: Some common perceptions about SolidWorks and memory usage.
Recent Comments