You are not logged in.

#1 2007-03-11 18:56:24

zergu
Member
From: Poland
Registered: 2005-10-10
Posts: 28
Website

Loading a program/libraries into RAM on boot

I was just wondering — is there any way to load a program (gVim for example) along with needed libraries into physical memory permamently for a one boot up? It would be nice to open it every time in nothing flat. Ramdisk is one option but I would have to copy all needed files there (probably a little mess in directory tree ). Any more ideas?

Offline

#2 2007-03-12 00:45:20

Pajaro
Member
Registered: 2004-04-21
Posts: 878

Re: Loading a program/libraries into RAM on boot

i thought about that.

The only solution that i could think of i couldn't find it: it would be a fuse filesystem that clones the directory where you mount it and copies it to ram. When you read, it should read from ram. When you write, it should write to both.

It should also have the option of "copy to ram as the directory is read" and "copy to ram on mount".

It doesn't seem complicated. The ramfs could be mounted inside of /tmp.

If someone is encouraged, it would be really cool, specially when you have apps like amule, that eat all disk cache after a few time.

Offline

#3 2007-03-12 07:04:21

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Loading a program/libraries into RAM on boot

I've also wanted this behavior (alas I'm no programmer). Ramdisk, as zergu mentioned, is not a true solution. If your RAM is full (because of working on very large files or having a thousand tabs open in firefox, for example), some used-up RAM will still have to be swapped out to accomodate the program you want to launch. This would be slow.

Perhaps... if there were a way to keep telling a program that it's currently in use even if it actually isn't. Hmm..

Offline

#4 2007-03-12 07:51:53

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Loading a program/libraries into RAM on boot

you know... linux is better than you at this sort of stuff... it loads things into ram, and caches them until it deems it's no longer needed.  I've never had a problem with something like gvim starting up...

Still you can try preload, or some fancy ramdisk tricks

Offline

#5 2007-03-12 07:59:47

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Loading a program/libraries into RAM on boot

Better at what? Better at determining what kind of behavior *I* want from my computer? Hehe.

I think what the other posters and I want is to be able to launch a certain program instantly regardless of anything, and not depending on what the OS "deems" should happen.

Offline

#6 2007-03-12 08:19:39

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Loading a program/libraries into RAM on boot

Simastrick wrote:

Better at what? Better at determining what kind of behavior *I* want from my computer? Hehe.

Better at knowing when to maintain programs in memory, and when to remove them so the memory can be used for other things.

The problem with maintaining things in RAM, is that that ram is not freed.  If this goes too high, it can cause massive swapping.

preloading all of gvim results in:

-rwxr-xr-x 1 root root 1438060 2007-03-04 07:56 /lib/libc.so.6
-rwxr-xr-x 1 root root   25217 2007-03-04 07:56 /lib/libcrypt.so.1
-rwxr-xr-x 1 root root   13446 2007-03-04 07:56 /lib/libdl.so.2
-rwxr-xr-x 1 root root  176787 2007-03-04 07:56 /lib/libm.so.6
-rwxr-xr-x 1 root root  111241 2007-03-04 07:56 /lib/libpthread.so.0
-rwxr-xr-x 1 root root   12477 2007-03-04 07:56 /lib/libutil.so.1
-rwxr-xr-x 1 root root   97575 2006-11-11 14:55 /usr/lib/libICE.so.6
-rwxr-xr-x 1 root root   37535 2006-11-11 14:59 /usr/lib/libSM.so.6
-rwxr-xr-x 1 root root 1063266 2007-02-27 16:59 /usr/lib/libX11.so.6
-rwxr-xr-x 1 root root    9812 2006-11-11 15:03 /usr/lib/libXau.so.6
-rwxr-xr-x 1 root root   40307 2006-11-11 15:20 /usr/lib/libXcursor.so.1
-rwxr-xr-x 1 root root   20620 2006-11-11 15:27 /usr/lib/libXdmcp.so.6
-rwxr-xr-x 1 root root   63628 2007-02-01 17:10 /usr/lib/libXext.so.6
-rwxr-xr-x 1 root root   17791 2006-11-11 15:09 /usr/lib/libXfixes.so.3
-rwxr-xr-x 1 root root   34191 2006-11-11 15:46 /usr/lib/libXi.so.6
-rwxr-xr-x 1 root root    8876 2005-12-18 06:47 /usr/lib/libXinerama.so.1
-rwxr-xr-x 1 root root   25198 2007-02-28 13:54 /usr/lib/libXrandr.so.2
-rwxr-xr-x 1 root root   33767 2006-11-11 15:17 /usr/lib/libXrender.so.1
-rwxr-xr-x 1 root root  361552 2007-02-01 17:08 /usr/lib/libXt.so.6
-rw-r--r-- 1 root root   27984 2006-06-29 23:57 /usr/lib/libacl.so.1
-rwxr-xr-x 1 root root  131572 2007-01-22 12:46 /usr/lib/libatk-1.0.so.0
-rw-r--r-- 1 root root   15458 2006-07-04 02:48 /usr/lib/libattr.so.1
-rwxr-xr-x 1 root root  465297 2006-11-11 16:13 /usr/lib/libcairo.so.2
-rwxr-xr-x 1 root root  159973 2006-08-18 15:44 /usr/lib/libexpat.so.1
-rwxr-xr-x 1 root root  212151 2006-12-22 17:12 /usr/lib/libfontconfig.so.1
-rwxr-xr-x 1 root root  559411 2007-02-08 04:32 /usr/lib/libfreetype.so.6
-rwxr-xr-x 1 root root  658596 2007-02-02 04:54 /usr/lib/libgdk-x11-2.0.so.0
-rwxr-xr-x 1 root root  108560 2007-02-02 04:54 /usr/lib/libgdk_pixbuf-2.0.so.0
-rwxr-xr-x 1 root root  722331 2007-01-20 05:41 /usr/lib/libglib-2.0.so.0
-rwxr-xr-x 1 root root   12814 2007-01-20 05:41 /usr/lib/libgmodule-2.0.so.0
-rwxr-xr-x 1 root root  296607 2007-01-20 05:41 /usr/lib/libgobject-2.0.so.0
-rwxr-xr-x 1 root root 4217572 2007-02-02 04:54 /usr/lib/libgtk-x11-2.0.so.0
-rwxr-xr-x 1 root root  296368 2006-12-25 02:26 /usr/lib/libncurses.so.5
-rwxr-xr-x 1 root root  291343 2007-02-26 16:39 /usr/lib/libpango-1.0.so.0
-rwxr-xr-x 1 root root   42260 2007-02-26 16:39 /usr/lib/libpangocairo-1.0.so.0
-rwxr-xr-x 1 root root  198973 2007-02-26 16:39 /usr/lib/libpangoft2-1.0.so.0
-rwxr-xr-x 1 root root  154248 2007-02-08 04:53 /usr/lib/libpng12.so.0
-rwxr-xr-x 1 root root  880808 2006-12-05 10:16 /usr/lib/libruby.so.1.8
-rwxr-xr-x 1 root root   78102 2005-07-20 13:58 /usr/lib/libz.so.1
-rwxr-xr-x 1 root root 3840124 2007-02-06 17:44 /usr/bin/gvim
Total:                16961898

Which is fairly significant for some systems.

Offline

#7 2007-03-12 09:30:00

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Loading a program/libraries into RAM on boot

phrakture,
Yes, in that case I wouldn't want to keep gvim preloaded. But I would still want this behavior.

Your first post was kinda impertinent, because we simply wanted to have the choice of preloading certain programs (and not necessarily gvim). I'm sure the other posters didn't want to take over the whole memory management business that linux is so good at. So your saying "linux is better than you..." is like, huh? Where'd that come from? tongue Were you implying that we should just forget the whole idea?

It's all about choice, man.

Last edited by Simastrick (2007-03-12 09:30:36)

Offline

#8 2007-03-12 10:31:19

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

Re: Loading a program/libraries into RAM on boot

i'm sorry+correct me if i'm wrong...but

i think he was referring to the fact that when you run an app. and exit, it remains cached in ram until the space is required, so if you run it again, providing you didn't run out of ram or something.. it will start pretty much instantly which imo, in most cases makes the initial copy,+ subsequent double writes pointless.

for me, (visually) gnome-terminal starts in about 1 second ... every run after that init. it's instant, basically the bottleneck is shifted to how fast gtk redraws the window.
amarok 2-3 seconds ..
sub. 1 second.


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

Offline

#9 2007-03-12 11:23:17

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Loading a program/libraries into RAM on boot

Indeed, what you say is true, "...providing you didn't run out of ram..."

I frequently work with very large files (high-resolution, multi-layer graphics, mostly) and often I have a few heavy-duty programs open at the same time. More often than not, my ram fills up, hence the relevance of this thread (for me, at least).

And yes, I also want certain programs to open instantly on first launch, not just on subsequent launches.

Please. The main idea of this thread exists because some people feel the need for the "perm-loading" behavior. Stop implying that it's 'pointless' and giving us your compromise-type solutions.

Last edited by Simastrick (2007-03-12 11:29:40)

Offline

#10 2007-03-12 15:20:03

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Loading a program/libraries into RAM on boot

Simastrick wrote:

So your saying "linux is better than you..." is like, huh? Where'd that come from?

Your car is better than you at going fast.
An umbrella is better than you at keeping yourself dry.

These are facts.  Saying that linux is better that you at managing which apps are cached and which are not is also a fact.  There's no need to get hyper sensitive here.  noriko has the right of it.  I am saying that when you start and app, then exit is doe the exact same thing as if you cached the application yourself. 

Simastrick wrote:

Stop implying that it's 'pointless' and giving us your compromise-type solutions.

But that's the truth.  It is pointless.  A few years ago everyone was into using 'preload' to make things start faster.  No one talks about it these days.  Why? Because it just doesn't make a huge difference.  Linux is good at maintaining this stuff in ram, and far better than a human can do (it operates millions of times a second).

If you really want to waste your time, here's preload's website: http://sourceforge.net/projects/preload

Offline

#11 2007-03-12 15:42:48

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: Loading a program/libraries into RAM on boot

A side-issue which provides boot -to-ram with the same caveat of first load is slower than subsequent calls.

Live Larch provides copy-to-ram of the whole OS and packages of interest in addition.  It can boot from flash stick, CD/DVD rom and can be made r/w through pacman.  Copy-to-ram requires much ram but the system runs at normal speed.

It may provide something of interest to you if you have many GB's of ram.


Sign of the times: Navajo blanket..made in China
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#12 2007-03-12 22:26:00

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 782
Website

Re: Loading a program/libraries into RAM on boot

One thing that actually will speed things up is mounting your root into ram on boot.  Then writing some pretty complicated stuff to handle it.  I did it in gentoo back in the day.

The real advantage in loading / in ram is not as much the speed of things ( which is dramatic, let me tell you ), but the security.  Your entire root can be deleted, and all you have to do is reboot because it happened in fake RAM land.

Offline

#13 2007-03-13 00:28:44

junglepeanut
Member
From: California
Registered: 2007-01-24
Posts: 145
Website

Re: Loading a program/libraries into RAM on boot

Sorry if this detracts from topic?
All of root to ram? I might be able to on my computer at school with 32GB of ram...but maybe I am misunderstanding what you mean by all of root? My personal computers root uses almost 5GB of HD space and I am sure it grows with time.

Offline

#14 2007-03-13 01:03:14

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 782
Website

Re: Loading a program/libraries into RAM on boot

Well, certain things you would not put in ram, like /home.  It all depends on your system.  I had a very very minimal setup.  Like my current server, it has just under 1 gig in it's /

Offline

#15 2007-03-13 02:24:28

junglepeanut
Member
From: California
Registered: 2007-01-24
Posts: 145
Website

Re: Loading a program/libraries into RAM on boot

OK, ps mine was without /home. Thanks, this sounds like very involved  choosing. If you must have this then I guess preload is the way to go much simpler.

Offline

Board footer

Powered by FluxBB