You are not logged in.

#1 2007-02-08 05:17:10

Galdona
Member
Registered: 2006-03-15
Posts: 196

preload specific program

Is there a way to preload a specific program into ram and keep it there? It's just gonna be a small program that I would like to open instantly anytime. (Oftentimes when I work on very large files, things start getting swapped out, and programs, even very small ones, can take several seconds to open. )

Last edited by Galdona (2007-02-08 05:17:54)

Offline

#2 2007-02-08 05:21:14

Galdona
Member
Registered: 2006-03-15
Posts: 196

Re: preload specific program

Oh yeah, I know about the preload pkg in the repos, but I would like my program preloaded even when it has not seen frequent use for a while. I would like it preloaded *all* the time. Is that possible?

Offline

#3 2007-02-08 05:59:47

mutlu_inek
Member
From: all over the place
Registered: 2006-11-18
Posts: 683

Re: preload specific program

Well, I am not sure whether I properly understand what you are looking for. But I will go ahead anyway... smile

AFAIK the only thing you can do is to create a ramdisk and copy your program into that ramdisk. The downside is that a) the ramdisk has to be created and the program copied to the ramdisk on every boot, and b) that changes to the files in the ramdisk are lost on reboot.

A quick example:

You need to create a folder (only once):

mkdir /mnt/ramdisk

And you should adjust the default ramdisk size (4MB) in grub or lilo by adding ramdisk_size=XXXXX (in kilobytes) to the kernel line.

Then you can execute this on every boot:

mke2fs /dev/ram0
mount /dev/ram0 /mnt/ramdisk

Finally, on every boot, copy the files/folders to /mnt/ramdisk. Do not forget to execute those files in the ramdisk instead of the files on the harddrive.

Offline

#4 2007-02-08 06:28:38

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: preload specific program

no need to use a ramdisk, it's easier and afaik better to use a tmpfs ...

none /rm     tmpfs     defaults            0      0
_ _ _ _ _ _ _ _ _ _
mount -t tmpfs tmpfs -o size=10M,nr_inodes=1M /rm


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#5 2007-02-08 07:06:59

mutlu_inek
Member
From: all over the place
Registered: 2006-11-18
Posts: 683

Re: preload specific program

I beg to disagree. tmpfs cannot discern between ram and swap. It will swap to the harddrive if memory is low. This would defeat the purpose.

tmpfs is, however, great for speeding up /tmp and in cases of large compilation tasks (it is, for example, really helpful on gentoo and saves lots of hdd life).

Offline

#6 2007-02-08 10:35:18

Galdona
Member
Registered: 2006-03-15
Posts: 196

Re: preload specific program

Thanks all.

mutlu_inek, that was exactly what I was looking for. I've set it up in rc.local so the ramdisk gets created at boot and the executables copied over.

Thanks!

Offline

Board footer

Powered by FluxBB