Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-14-2003, 12:58 PM
|
#1
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
how can i pre-load applications into ram automatically at startup???
you know how once you open an application and then close it most of it's "stuff" is cached in ram and the swap partition, so as that next time you open your application it will load that "stuff" from there (ram, swap) and open much faster than the first time???
i'd like to make my parent's linux box pre-load some apps into ram automatically at every system startup so that when they click an icon the apps will load much faster than if they weren't cached...
i'm thinking about doing this to mozilla and openoffice.org, for example, but i don't know how to do this yet, so i am hoping someone like you will show me the way...
850mhz (amd duron) / 128mb pc-133 / nvidia tnt2 - it's a mandrake 9.1 box but i'd like to learn how to do it in a non-distro-specific way if possible...
i'd really appreciate any help you could give me... thanks!
|
|
|
11-15-2003, 03:04 PM
|
#2
|
Member
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335
Rep:
|
You could create a ramdisk and copy the desired programs into the ramdisk but with 128 MB RAM, you would be limiting the efficiency of Linux...
You could add these to autostart but then they would actually load and start at each login.
|
|
|
11-15-2003, 04:47 PM
|
#3
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
Original Poster
|
hello TheOther1 and thanks for your input!
i'm looking to make it load and close the applications just like normal (from the disk, but behind the scenes) so as that the regular (super excellent) linux memory management goes into effect without creating a ramdisk to load the apps from (which would, as you stated, take a large slice from my little bit of ram)...
i think i should mention that the machine is set to auto-login, my aim is to make it load the applications inside the auto-logged-in account.... perhaps in such a way that ONLY the auto-logon account pre-loads (and closes) the applications for itself and all other accounts behave like normal...
setting the applications to load on account startup is exactly what i want, but i need for it to happen BEHIND THE SCENES (it would suck to actually SEE all the apps loading every boot and having to close them by clicking) and for them to auto-close after loading:
- computer boots
- auto-login
- gui loads (perhaps temporarily disabled while the next step completes)
- selected applications are loaded in the background and immediatley closed (killed?)
- desktop is presented as usual (except the "pre-loaded" apps will already have most of their "stuff" in ram and swap so they'll load quickly)...
i'm sure this would be done using a shell script set to run on account log-in... maybe there's a modifier or something you can put after any command to make it happen in the background (a la "wget -b")? then it could be just a matter of setting the script to do a "kill" on the process after the app loads?
|
|
|
11-15-2003, 05:25 PM
|
#4
|
Member
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335
Rep:
|
Maybe a bash script that looks something like this?:
#! /bin/sh
mozilla &
otherapp &
sleep 2
kill `ps aux | grep mozilla | grep -v grep | awk '{print $2}'`
kill `ps aux | grep otherapp | grep -v grep | awk '{print $2}'`
That would start apps, sleep for 2 seconds to give apps a chance to start, locate pid of mozilla and kill it, find pid of otherapp (replace with app name) and kill it.
|
|
|
11-16-2003, 10:08 AM
|
#5
|
Member
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720
Rep:
|
You could just do..
killall -9 mozilla-bin instead of all that kill `....`
Note that this isn't going to work on startup.
You need to already have a working xsession or mozilla is going to fail and complain about no X.
|
|
|
11-16-2003, 10:47 AM
|
#6
|
Member
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335
Rep:
|
Not sure, but I would be willing to bet the kill `....` process is actually faster (by milliseconds) than killall since killall calls kill, fuser, pgrep, pidof, and ps. Who knows?
|
|
|
11-16-2003, 11:26 AM
|
#7
|
Member
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720
Rep:
|
Possibly.. but it's simpler to read and make out what it means for people who are new.
|
|
|
11-16-2003, 03:50 PM
|
#8
|
Member
Registered: Feb 2003
Location: Atlanta, GA
Distribution: RHAS 2.1, RHEL3, RHEL4, SLES 8.3, SLES 9, SLES9_64, SuSE 9.3 Pro, Ubuntu, Gentoo
Posts: 335
Rep:
|
True!
|
|
|
12-07-2003, 05:30 PM
|
#9
|
LQ Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
Original Poster
|
thanks, you guys!
sorry for not posting in such a long time... i was away from information technology for a few weeks...
the shell script works very well... i created an ".xsession" file in my parent's home directory (so that the script will run when X starts) with this in it:
mozilla &
swriter &
sleep 55
kill `ps aux | grep mozilla | grep -v grep | awk '{print $2}'`
kill `ps aux | grep OpenOffice | grep -v grep | awk '{print $2}'`
exec /usr/bin/X11/blackbox
all i changed was the sleep time, so the apps could open completely before the kill (openoffice.org would act funky after getting killed while still loading, etc.)... and of course i added the line at the end so that the window manager would be started after everything was killed...
so now linux boots up, auto-logs in, starts X, starts mozilla and swriter (while waiting for 55 seconds*), kills them and their family, and then runs the window manager with all the "stuff" cached... which is exactly what i was looking for so once again THANK YOU SO MUCH!!!
the only thing that sucks is that one can actually "use" the apps during the pre-load... you innocently begin to type in a URL in mozilla and before you hit enter everything gets killed and you have an "explorer.exe crash flashback"... LOL
it would be rad if you couldn't SEE the pre-loading apps, and if the keyboard and mouse clicks were disabled during this pre-load process... some kinda message box or status bar letting you know what's going on would be even more rad (radder?)... i'm googling around for this stuff but as always your input is greatly appreciated...
by the way, normally openoffice.org takes 30 seconds to open on this machine... now with this pre-loading it takes 10!!!
=)
* it's cool, they usually turn the pc on (in the morning) and go make coffee before actually using it... =)
|
|
|
12-07-2003, 08:47 PM
|
#10
|
Member
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720
Rep:
|
From mozilla --help
-height <value> Set height of startup window to <value>.
-width <value> Set width of startup window to <value>.
openoffice probably has that too, just set it to 1 and 1 or 0 and 0, that should fix it
|
|
|
02-24-2004, 05:20 AM
|
#11
|
Member
Registered: Feb 2004
Location: Sacramento, CA, USA
Distribution: Mandrake 9.2
Posts: 159
Rep:
|
No matter what, with 128MB of ram, you are already hindering performance. If you use ramdisk, or try to preload the programs into memory, you are still going to be using nearly equal amounts of ram. Save yourself a headache and get some more memory. Memory is dirt cheap now, and you will see improved performance in the system alone by adding more memory. The only system that I have only 128MB of ram in is my Pentium 150 laptop, because that is all it can read. With an 850mHz system you will see a substantial speed increase by doubling the ram.
|
|
|
All times are GMT -5. The time now is 12:24 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|