Conflicting defintions of virtual memory

2

It seems that there are two definitions of virtual memory, and I'm wondering do they both describe the same thing or is it that two similar but distinct concepts are called the same thing?

Definition 1: a means of extending RAM by using secondary storage

"Virtual memory is a feature of an operating system (OS) that allows a computer to compensate for shortages of physical memory" -techtarget

"Virtual memory is simulated RAM. When you have used up all your RAM, your computer will shift data to an empty space on the hard drive." -delete-computer-history

"Virtual memory is a technique that allows the execution of processes which are not completely available in memory" -tutorialspoint

Definition 2: system by which memory is addressed

"virtual memory is a memory management technique ...It maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory." -wikipedia

and virtual memory is what's responsible for giving a program it's own address space, so it can assume it's beginning is at address 0x00

Question: am I confused? How are these definitions compatible?

Celeritas

Posted 2016-01-06T06:59:30.073

Reputation: 7 487

Answers

2

Virtual memory is any memory that is not necessarily mapped one-to-one to physical memory. It usually describes a concept or architecture and implicates some interface to use it.

So basically, both your stated definitions can apply: It can be memory that is stored on other media than your main RAM, and it may have addresses that do not correspond to physical addresses.

For example on Windows, your applications may have memory areas sharing the same virtual address but have different contents while some other areas at equal addresses share the same contents, e.g. code from libraries, and you may also have shared contents at different addresses for each app, especially with ASLR, where addresses are randomized.

At the same time, virtual addressing also introduces a means to map virtual memory to disk transparently, usually with the help of CPU exceptions or interrupts that are raised when code accesses memory that is not mappable to physical RAM, so that the operating system can automatically load the data into RAM and then grant access to it.

Archimedix

Posted 2016-01-06T06:59:30.073

Reputation: 231

0

They're describing the same thing. The Wikipedia article is a technical explanation. I think the article's intro is poorly/awkwardly worded, though. The main body of the article describes it pretty thoroughly.

Virtual memory, as a noun, is any bit of storage used to keep what would otherwise be in memory but isn't, usually because there isn't enough room there or it won't be needed for a while (relatively; "a while" could be fractions of a second). Usually this is space on some kind of long term storage borrowed for the purpose (page files on hard drives are the common example). In some situations (like for servers), this can be hardware built for the purpose.

The Wikipedia article talks about this, but expands the concept to the subsystems (such as virtual addressing) that help make the implementation possible.

Ouroborus

Posted 2016-01-06T06:59:30.073

Reputation: 2 549

Can you explain how they are actually describing the same thing? – Celeritas – 2016-01-06T07:36:15.280

One can arbitrarily break "storage" into two types: "memory" and "everything else". That "everything else" is usually slower and longer term. Otherwise, they're the same thing, a way to store data. When people like you and me talk about virtual memory, we're usually talking about the storage media. When computer science people talk about it, they're talking about the whole thing, including the bits that arrange for it to even be possible. The Wikipedia article treats it like a computer science topic (as it should). The other articles treat it like the common folk do. – Ouroborus – 2016-01-06T07:49:00.320

0

They are describing two (related) things. The first is describing how the system copes with not having enough physical memory by swapping some of the information back and forth between physical memory and a disc drive. This is hidden from the running programs by the operating system and makes the physical memory appear larger than it actually is. Try looking up RAM swap files

The second is describing how a processor decides which part of memory (normally actual physical memory) to access for each program running on a system. It could be decribed better as virtual memory addressing. This way each program running on the machine can think it has it's own dedicated memory block, starting at address 00000 but in actual fact the memory blocks are actually spread across the physical memory. Try looking up memory addressing, pointers

Jim Smith

Posted 2016-01-06T06:59:30.073

Reputation: 1