Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I am interested in obtaining (or building myself) a version of the Linux kernel that has absolutely no virtual memory and none of its attendant overhead. No swap file, no nothing.

What are my options?

share|improve this question
2  
Virtual memory has NOTHING to do with swap. Nada. Zip. Zero. Two completely unrelated concepts. You could have a system that uses virtual addressing but no swap, and (theoretically) a system that uses swap and no virtual addressing. On linux, use of swap is optional, but virtual addressing -- which I am guessing you have significantly misunderstood the purpose of -- is integral, just as it is for every other widely used modern operating system. There may be some highly specialized ones out there that do not (in the embedded world) but they would be useless outside that. –  TAFKA 'goldilocks' Sep 19 '13 at 23:08
1  
@goldilocks "and (theoretically) a system that uses swap and no virtual addressing" More than theoretically. One example is Mac OS Classic (i.e., the stuff before Mac OS X) –  derobert Sep 19 '13 at 23:11
1  
@goldilocks Linux can work on systems which only have an MPU (memory protection unit: assigns permissions to hardware pages) and no MMU (no virtual addressing). An MPU is enough to enforce isolation between processes, but it makes some features such as fork nigh-impossible to implement, which puts a serious crimp in a unix system. –  Gilles Sep 20 '13 at 0:35
add comment

marked as duplicate by slm, Gilles, Drav Sloan, jasonwryan, TAFKA 'goldilocks' Sep 19 '13 at 23:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

Any kernel can do this.

Simply do not assign any swap, then you are only left with "real" memory.

swapoff -a 
share|improve this answer
add comment

As far as I know, you cannot disable the concept of virtual memory in Linux, at least not without totally rewriting it. It's an integral part of the memory management and lots of stuff simply would cease to work if you could disable it.

The mmap call can be used to map a file or a device to a part of an application's virtual memory (every application has 4 GB virtual memory on 32 bit, and 16 EB on 64 bit). For example, an application could mmap several megabytes of the hard disk into its own virtual memory. It could then access this part of the hard disk just by accessing its own memory—the kernel will automatically fetch the required data from the hard disk, store it in the RAM and return this data to the application. If you could disable virtual memory, this application would now no longer work.

On the other hand, swap can be disabled very easily, just by running swapoff -a or not setting up swap partitions in /etc/fstab at all.

share|improve this answer
    
Well, there is µClinux ... –  derobert Sep 19 '13 at 22:57
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.