1

Like I will use google chrome whenever I use linux (most probably) But I don't want it to auto start when ever I open it. I could open it manually, but I have HDD so it is pain to load for the first time, so I wanna know if there is a way to load chrome from HDD to RAM without really running it, Just load, and make cache in RAM.

1 Answers1

1

I use vmtouch.

vmtouch opens every file provided on the command line and maps it into virtual memory with mmap(2). The mappings are opened read-only. It recursively crawls any directories and does the same to all files it finds within them.

[…]

-t
Touch virtual memory pages. Reads a byte from each page of the file. If the page is not resident in memory, a page fault will be generated and the page will be read from disk into the file system's memory cache.

Note: Although each page is guaranteed to have been brought into memory, the page might be evicted from memory by the time the vmtouch command completes.

To overcome what the above note states, I use vmtouch -l (as root):

-l
Lock pages into physical memory. This option works the same as -t except it calls mlock(2) on all the memory mappings and doesn't close the descriptors when finished. At the end of the crawl, if successful, vmtouch will block indefinitely. The files will be locked in physical memory until the vmtouch process is killed.

My usage case is to preemptively cache relatively large media files from a relatively slow NFS server over a relatively slow network connection. It works very well. It should work for you. You just need to identify the files you want to load. This question may be useful: How to find out the dynamic libraries executable loads when run?