[net.unix-wizards] Virtual Memory and Control Theory

lee@fortune.UUCP (12/02/83)

This is a comparison of real memory and virtual memory systems
vs. open-loop and close-loop control systems.  This is an attempt
to show that virtual memory systems are more effective than real
memory systems.

Real memory systems allocate resources according to programs
requirements [ open-loop systems manipulate variables in fixed
state space ].  Virtual memory systems allocate resources according
to current usages and demands [ close-loop systems steer variables 
using current states and desired paths ].  Virtual memory systems
estimate future demands with past histories, i.e. Least expected usages,
longest time to last used, etc [ close-loop systems estimate current
states using state estimators ].  Virtual memory systems response
to memory faults [ close-loop systems response to feedback error
signals ].   Virtual memory systems start trashing as ratios of
logical memory to physical memory increase [ close-loop systems
become unstable as ratios of internal state value to external
state value increase ].

It can be proven mathematically that close-loop systems response
better than open-loop systems.  It is sufficient to show that
virtual memory systems are indeed close-loop control systems.

	Ed Lee
	fortune!lee

leichter@yale-com.UUCP (Jerry Leichter) (12/06/83)

All that is true but may very well be beside the point:  What't the total
cost of doing virtual memory?  You can't look just at the benefits if you
claim to provide a mathematical justification.

Years back, Gene Amdahl was asked why he didn't put virtual memory support
into the 360 architecture.  His answer:  He had never seen a virtual memory
system that didn't impose a 10-12% performance hit, which he found unacceptable.

Fade 20-odd years later.  I.P. Sharp is a major Canadian timesharing service,
providing APL to large numbers of users.  They use Amdahl 470's.  They run
the Amdahls with virtual addressing turned off.  Guess what:  Sharp's 470's
give about 10% more performance than anyone else's 470's.

(I'm afraid I don't remember the reference for these interesting facts; it
was a pretty authoritative one, though.)
							-- Jerry
					decvax!yale-comix!leichter leichter@yale

BTW, before you get TOO carried away in your analysis:  A non-virtual memory
system with overlays is a closed-loop system.  There are a LOT of possible
approaches.  The Sharp APL implementations presumably keep all the system
code in memory at all times, and move user workspaces in and out as needed;
since the code that controls the movement knows a LOT about the semantics
of the workspaces, it is in a much better position to make good decisions
about what and when to page where than a straight VM system, which has to
guess.
							-- J

stepp@uiuccsb.UUCP (12/10/83)

#R:fortune:-187100:uiuccsb:14900006:000:2068
uiuccsb!stepp    Dec  9 10:15:00 1983

Don't confuse the concept of virtual memory with the content swapping technique.

Virtual memory means that the logical address space is different than (exceeds)
the real address space.  There are a variety of ways to accomplish this.
Traditional overlays do not use virtual memory:  all logical addresses are
equal to real addresses, though some are effective only when certain
content is present in memory.

For programs whose logical address space is smaller than the available real
address space, memory-sharing may be accomplished via overlays (swapping) or
demand paging.  For programs whose logical address space exceeds the available
real address space either the user must reorganize the program to shrink the
logical address space via managed overlays or the program must run in a
virtual memory system.

For the case of programs whose size does not exceed the available real memory
size, many systems exist which use overlays (managed swapping) for the sake
of lower overhead.

Demand paging is the least intelligent content swapping method for virtual
memory management.  It is widely used precisely because it need not know much
about the program's use of the logical address space (its idea of the needed
pages (working set) of the program is obtained by analysis of the history
of the program, not from knowledge of the program's algorithm).  Other smarter
virtual memory paging strategies are certainly possible, but they require
additional information (such as the future program flow characteristics) in
order to out-perform simple demand paging.

So, for programs which are small (or for which the author does not mind
carrying the burden to plan their overlays) it is not surprising that non-
virtual memory systems using swapping perform very well indeed.  There are
many applications however where the logical address space is very large and
it is very difficult to plan overlays to shrink the logical space to the
limits imposed by available memory.  Thus virtual memory systems are necessary,
in spite of the overhead imposed by demand paging.