Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
An imaginary memory area supported by some operating systems (for example, Windows but not DOS) in conjunction with the hardware. You can think of virtual memory as an alternate set of memory addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. When the program is actually executed, the virtual addresses are converted into real memory addresses.
The purpose of virtual memory is to enlarge the address space, the set of addresses a program can utilize. For example, virtual memory might contain twice as many addresses as main memory. A program using all of virtual memory, therefore, would not be able to fit in main memory all at once. Nevertheless, the computer could execute such a program by copying into main memory those portions of the program needed at any given point during execution.
To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real addresses.
The process of translating virtual addresses into real addresses is called mapping. The copying of virtual pages from disk to main memory is known as paging or swapping.
there are a couple of different types of memory - there's the cpu cache, which is usually just about 256k on today's machines, RAM memory - up to several gigs, and virtual memory, which is limited by the amount of swap space available on your hard drive.
cache is pretty small - but very fast.
RAM is getting pretty large nowadays, and is somewhat slow in cpu terms.
virtual memory is stored on the hd and is very large, but is EXTREMELY slow
virtual memory handling is one of the most difficult parts of o/s programming - there are debates daily on the kernel mailing list about it.
i think tricky's explaination was a bit obscure, so i'll give it a go here:
physical memory, RAM, is usually on the order of 128M+ on todays machines - this isn't really enough tho, for a full desktop system. so, in order to make more room, the kernel uses virtual memory - it writes memory stored in RAM to the hard drive, and frees up some RAM, enabling the computer to move significantly faster. if that memory is needed again, the kernel swaps out some memory in RAM for the memory on the hard drive, and so on and so forth.
CPU Memory..Defined by Cache.
L2 Cache - Generaly 256k, but lower in celeron and lower grade cpus.
L1 Cache - Usually smaller again.
Ram - Random access memory - Running on the system bus but at a greater distance from the cpu than the L2/L1 cache. Common types are sdram Syncronis (i can't spell) dynamic random access memory..most modern machines use RDRAM which here in NZ cost twice as much as SDRAM..but my old favourite will always be good old edoram..oh how I loved my 4meg of 1meg simms..
Virtually memory - Defined by the operating system and used generally by application software and not system software. Limited tooo..I think 4gig at the moment..could be wrong..
So the answer to the question is..if you've got 1024meg of physical memory you generally don't need much if any virtual memory, most likely that will change in a year or so..
and for me..512meg ram and I hardly ever see it use virtual memory..
But like I said I could be wrong and in which case my cpu is going senile.
The lengths of boredom this job drives me to..
Last edited by dj_relentless; 02-13-2002 at 01:39 AM.
Originally posted by isajera i think tricky's explaination was a bit obscure, so i'll give it a go here
yep, this is a type of question maybe the person asking could look into themselves.. that is why i looked up virtual memory and gave him the actual definition. it is obscure, but so is the question i think.
aww no fun, I missed my chance to wax lyrical about the differences between writeback and writethrough cache management schemes... I actually understand it tooo...! ahh well, another day.
i heard virtual memory is mainly for solving memory fragmentation..
if i understand previous postings correct,
virtual memory concept = cache concept ?
cache :: ram
==
ram :: disk(where virtual memory informations will be stored, if ram is maxed out with other processes)
Originally posted by doublefailure i heard virtual memory is mainly for solving memory fragmentation..
if i understand previous postings correct,
virtual memory concept = cache concept ?
cache :: ram
==
ram :: disk(where virtual memory informations will be stored, if ram is maxed out with other processes)
well:
cache and vm are something entirely different.
cache is a concept to reduce access time to e.g. ram.
the trick is that ram is far away from the cpu and access is slow, so data is stored in the cache to be fast accessible.
vm is part of the abstraction current OSes do to you're system.
The idea behind this abstraction is that thus the programmer does not need to know about actual memory/hardware layout. the os does this for him.
So basically every program has it's own memory space. The OS translates this to physical memory.
ram is not the same as chace.
ram is slow and far away reachable over a bus. the caches are moved closer to the cpu and are much faster accesible.
iirc L1-cache is usually part of an cpu, wereas L2-cache is separated from the CPU but in it's close vicinity (sp?) so it can be accesed fast.
ram is not the same as swap (if that's what you mean with disk).
The crux of VM is here that the logical (the programs) adress space is much higher that physical memory. Thus it is possible that the various programs running use up more memory than is actually available, in such a case the data im memory is swapped to the disk (extra slow) to make physical memory available to running processes.
ok...since this thread is discussing memory.....and i also have one important question to ask....
Linux uses /dev/shm as shared memory
Now we have a swap space which the kernel utilizes according to its own need, if required....Lets for example, take the output of 'mount' command on my machine :
/dev/hda2 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620) none on /dev/shm type tmpfs (rw)
/dev/hda1 on /mnt/c: type vfat (rw)
I've seen the concept of "shared memory" mostly in the case of P-III machines with the Intel 810 motherboards that share RAM between normal OS use and graphics....However, I have an AMD-K6 400 MHz processor and a SIS 6326 Video Card with 8 MB VRAM.....I also have 256 MB RAM and 512 MB swap space set in Linux.......
Firstly, If the kernel already has a swap space (virtual memory), then when and for what purpose does the kernel require shared memory? ( Yes, I can see that currently shared memory usage is zero!)
Secondly, can size of shared memory be increased? if yes then how is that done, and will that help in any way to make system speed or loading of graphics faster?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.