Preloads files needed for given programs.
Shell C
Failed to load latest commit information.
etc typo Mar 17, 2016
usr do not use single file arguments to fmlock May 11, 2016
README Should now work with fmlock Mar 21, 2016


GOPreload Readme

	Got tired of the way the kernel decides what to keep cached and what
	not, expecially after watching a DVD or copying large files,  
	i decided to write two simple scripts which keep the applications
	i use most in the system cache by mmapping and mlocking them in memory.

	fmlock (sourcecode included thanks to datenwolf)

	* Put everything under /
	* You may want to edit /etc/gopreload.conf
	  to customize gopreload to your needs.
	* systemd users:
		systemctl daemon-reload
		systemctl enable gopreload
	* To give regular users the ability to choose new programs
	  to preload, give them write access to:
		/usr/share/gopreload/enabled and
Usage and example:
	First of all, you must think on a few applications which you REALLY
	need to be very responsive on starting.
	Take firefox as an example:

	I will use then '' that way:
	/usr/share/gopreload/bin/ firefox
	(wait for Firefox to fully load and press ENTER in the shell)

	Now has created a new file called firefox.YourUID.openfiles.txt
	in the /usr/share/gopreload/enabled/ folder.
	The generated filename includes an estimation of the MB wich will stay
	residents in ram.
	It contains the list of files which firefox needs to start-up, the
	idea is to keep them in ram so that next time firefox will start,
	it will not read them from disk and will start-up much, much faster.

	You can reiterate as much as you like, think at konqueror,
	nautilus, kwrite, gedit and so on, but don't do too much, because
	your memory is limited.

	As soon as you update firefox or it's needed libraries, you will
	need to (re)Prepare it again!
	To re-prepare your programs in an automatic/batch way, 
	(eg: after system upgrades), you can use:
	Non systemd users:
		Now that you 'prepared' your programs,you need to use'',
		and you need root privileges.
		sudo /usr/share/gopreload/bin/
	systemd users:
		systemctl start gopreload

	Just sit and wait for to preload the file lists 
	you created with, next time (and forever) you will launch 
	the programs, you choose, you will notice a nice speed boost, 
	even if you're short of memory. can be launched with debug parameter:
	./ debug see some interesting things.

	You may have noticed that there are two folders under GOPreload:
	* /usr/share/gopreload/enabled/ meaning should now be clear
	* /usr/share/gopreload/disabled/ is empty, you can use it to move filelists 
	'on the fly' from enabled/ to disabled/ folder. will notice the changes and will react accordingly.

Configuration Variables:
	* MAXMB is the Maximum filesize (in MB) to preload at 'prepare' stage.
	  files bigger than MAXMB will NOT be included in the list.
	  Small files tend to slow down things more than big ones,
	  big files will use a lot of ram, so i suggest you to keep
	  it to a value not greater than 15MB.
	* EXCLUDE_LIST contains a list of file extension you wan't preload.
	  Maybe you would like to exclude avi, mp3 and so on...
	  Please, refer to to learn the syntax.
	* MAXMB is the Maximum filesize (in MB) to preload at 'preload' stage.
	  files bigger than MAXMB will NOT be preloaded, even if they are
	  in the list created by, set it to "-1" to disable the
	* LONG_DELAY is the time (in seconds) to check if enabled/ disabled/
	  content has changed, don't set it too low or leave as default.

	*As could be very heavy the first time it starts
	 (i use it to load about 150MB of files), i suggest you to launch it
	 with nice and ionice at boot time in your rc scripts using something
	 like that:
	 nice -n 19 ionice -c3 sh -c '/usr/share/goPreload/'
	 (this is done automagically by the systemd service)

	*Please note that even if you have, say, prepared konqueror which takes
	 20MB of ram and kwrite which takes 14, it is more likely that
	 if they are preloaded togheter, they will share a lot of (kde)libs,
	 so you can expect them togheter to keep only a little more of 20MB.

	*Please note that programs which you prepare can't be swapped 
	 to swapfile.

Some Benchmarks; Start Application Times

Program     |WithPreload    |WithoutPreload
            |               |
oowriter    |0m3.502s       |0m11.768s
thunderbird |0m3.704s       |0m12.675s
firefox     |0m5.038s       |0m16.160s
winecfg     |0m2.559s       |0m5.032s
kwrite      |0m1.166s       |0m3.045s