Difference between cache and virtual memory.

Other Mainframe related questions which attracts you and there is no suitable Forum you find for it and related FAQs.
Post Reply
Ramnath
Registered Member
Posts: 20
Joined: Thu Aug 01, 2013 6:57 pm

Difference between cache and virtual memory.

Post by Ramnath »

Hi,

What is the difference between cache and virtual memory? Don't they just serve a very similar purpose? Can anyone of you please share your views on it?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 824
Joined: Wed Sep 11, 2013 3:57 pm

Re: Difference between cache and virtual memory.

Post by enrico-sorichetti »

Don't they just serve a very similar purpose?
NO
Can anyone of you please share your views on it?
for such questions personal views are irrelevant and most often wrong ...

start by trying to understand
cache to real storage relation (ram in PC jargon )
real storage(memory) to virtual storage relation

a good reading would be
http://www.redbooks.ibm.com/abstracts/sg246366.html
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Difference between cache and virtual memory.

Post by Robert Sample »

The z13 overview at http://www-03.ibm.com/systems/data/flas ... _Final.pdf makes a big point about the L1, L2, L3, L4 caches.  L4 has 960 MB while the z13 can have up to 10 TB of memory.  Once you've read the reference enrico cited, you can look at this Powerpoint and see how differently cache and virtual memory are treated.
Ramnath
Registered Member
Posts: 20
Joined: Thu Aug 01, 2013 6:57 pm

Re: Difference between cache and virtual memory.

Post by Ramnath »

Thanks for the manual links.
Gerhard_Adam
Registered Member
Posts: 14
Joined: Thu Nov 26, 2015 10:51 am

Re: Difference between cache and virtual memory.

Post by Gerhard_Adam »

The primary difference is that virtual memory is a concept, while cache memory is real, physical memory. As mentioned previously, the z13 has 4 levels of cache memory and then central storage [RAM]. The role of cache memory is to improve the access speed to instructions and data. Each core has a Level 1 [L1] cache from which instructions are processed and data is referenced.

When the system executes an instruction, everything must be available in the highest level cache to be acted on. The primary reason for this is speed. It takes about 600 machine cycles to retrieve something from RAM, so it is far too slow to keep pace with modern processor speeds. As a result, this information is staged up into the L1 cache for fast access.

The purpose of the L2, L3, and L4 caches is as more data comes into the L1 cache, these lower level caches ensure that the data gradually "drifts" back down to RAM. This way, if it is re-referenced it is at a higher level cache and can be more readily promoted again.

Caches are also used in a variety of other devices, any time it is desired to improve the access speed by staging data ahead of time. Disk controllers use cache memory to perform "read ahead" on sequential files. It is used to complete write operations rather than waiting for the disk to be updated.

Virtual memory, on the other hand is a concept that defines how these real memory resources are going to be managed. In z/OS, memory is divided into 4K pages [or page frames to represent their real storage use]. This provides two benefits. In the first if storage demands are too high, the system can take unreferenced pages and move them to disk. In this way if the page isn't being used, then there's really no point in keeping it in real memory, so the move to disk may be beneficial.

This only occurs when the system's pool of available page frames is below a threshold value. However, paging is NOT a desirable state, and is used to manage how committed real memory is to existing work. Paging is considered to be occurring when pages that have been moved to disk need to be brought back into real memory.

The most important role of virtual memory is that it provides a "view" to the program. In other words, since each piece of memory is divided into 4K pages, then the system can provide a virtual view of those pages so that they all appear together, regardless of where they physically reside. As a result, each program that runs views its storage usage as being uniform and contiguous.

This is a major factor in storage management because it allows each unit of work to view a logical organization of data without causing the fragmentation problems that would occur if real storage had to meet these needs.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Other Mainframe Topics, Off-Topics, FAQs.”