Ubuntu: How can I run a complete application from RAM? [duplicate]


Possible Duplicate:
Can I use all my RAM for application data?

When I do some stuff in background (unpacking, compiling, backup, etc.) my hdd is under load and for example, Firefox and Chromium take very long to start and react very slow.

While my hdd is under load I have still plenty of free RAM and free CPU.

How can I copy the whole Firefox or Chromium including all dependencies into RAM?

I don't care about persistence, I just want to view some websites, videos, etc.

There are instructions putting the cache into /dev/shm, but that didn't speed up so much. Getting the profile into the RAM drive might also be easy... But how to get the binaries with all dependencies into RAM?


You do not need to copy all dependencies in the RAM, since, Modern application doesn't load all of it's function at the same time. They load them from disk, when necessary.

Yes, The system may use HDD sometimes to make room for sufficient RAM, So, that it can load another application which may require more RAM. So, it uses a feature called "Swapping".

"Swapping" is good, since it enables you to load more applications at the same time. But it uses hard disk, which is a slow process.

So, if you believe that, you have sufficient RAM for not using swapping at all, you can disable swapping altogether.

To temporarily disable swapping: run this sudo swapoff -a in a terminal and hit enter.

If you want to disable swapping permenantly do this:

  • Open a terminal and run sudo gedit /etc/fstab
  • Carefully delete the line which contains word swap. save and exit gedit.
  • Restart and Login again.

Note: You should make a backup of /etc/fstab file, so that if somethings go wrong, you can restore that.

To backup: sudo cp /etc/fstab /etc/fstab.backup

To restore: sudo cp /etc/fstab.backup /etc/fstab

Hope this will help


Memory management is handled by the OS it self. It schedule all the process to give same amount of time to execute. That's the basic of an multiprocessing OS.

Also how many data of an process loaded to RAM is decided by the application. If a application require a memory more than available memory than OS handles it by writing some part of it to virtual page (SWAP space in linux system). (Search for Paging technique of OS). So if you are plenty of memory be sure the OS is using it properly as requested by the application.

So basically you can't copy anything to RAM. (Also what is RAM drive?). Writing to RAM is done by OS.

I doubt in one statement that there are plenty free CPU while the background task is running. Possibly you have misunderstood something.

Last thing you can use to change priority of the process so the CPU gives more time to that process. renice or nice is the command. But the possibility of system freez/crash , unstable behavior is expected when you change priority.


The linux kernel automatically loads in-use files into RAM, so there wouldn't be any specific benefit to doing what you ask. When you are compiling or doing other heavy-load processes, what you describe is a CPU bottleneck (processing power). The best solution would be to play around with the priorities given to each job - specifically setting the "background" jobs to take up less CPU, at the expense of taking more time to complete.

That would be accomplished using the 'nice' command: http://manpages.ubuntu.com/manpages/oneiric/man2/nice.2.html


  • Start any applications before starting intensive processes (compiling). That way they will be already loaded in RAM and should respond faster.

  • Decrease swappiness to avoid using swap, thus reducing disk usage. Note that changing swappiness does not disable the swap file, just makes the kernel be more conservative when deciding to move things to swap. A very low swappiness will make the kernel not use swap unless you're absolutely, positively out of RAM. http://en.wikipedia.org/wiki/Swappiness

  • Start your intensive processes using nice and ionice to lower their CPU and I/O priority, this should keep the interactive apps more responsive. Read man nice and man ionice to understand what these two utilities do.

    nice -n 19 ionice -c2 -n7 your-intensive.process

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »