LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 11-14-2003, 12:58 PM   #1
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Arrow 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!
 
Old 11-15-2003, 03:04 PM   #2
TheOther1
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: Reputation: 32
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.
 
Old 11-15-2003, 04:47 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Original Poster
Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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?
 
Old 11-15-2003, 05:25 PM   #4
TheOther1
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: Reputation: 32
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.
 
Old 11-16-2003, 10:08 AM   #5
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
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.
 
Old 11-16-2003, 10:47 AM   #6
TheOther1
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: Reputation: 32
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?
 
Old 11-16-2003, 11:26 AM   #7
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
Possibly.. but it's simpler to read and make out what it means for people who are new.
 
Old 11-16-2003, 03:50 PM   #8
TheOther1
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: Reputation: 32
True!
 
Old 12-07-2003, 05:30 PM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Original Poster
Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Talking

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... =)
 
Old 12-07-2003, 08:47 PM   #10
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
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
 
Old 02-24-2004, 05:20 AM   #11
Nic-MDKman
Member
 
Registered: Feb 2004
Location: Sacramento, CA, USA
Distribution: Mandrake 9.2
Posts: 159

Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically load ittv drivers at startup cdhgee Linux - Software 3 12-29-2005 12:59 PM
Start applications automatically on an unprivileged user? DeathGoth Linux - General 3 10-27-2004 04:29 AM
Applications close automatically, hardware issue Balkman Linux - Hardware 6 04-20-2004 10:44 AM
pre load Install problems with Mandrake 7.2 muskie Linux - Newbie 3 01-06-2004 05:14 AM
Automatically resolving WINDOWS paths to pre-configured Linux paths gazzy Linux - General 1 09-05-2003 10:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration