# Making FreeBSD BLAZING Fast



## JoshuaBranson (Jul 26, 2011)

Ever heard of Puppy Linux? Apparently it loads the entire operating system into RAM. That means that when you boot up Puppy Linux and open up LibreOffice Writer, Abiword, Firefox, or any application, it just opens insanely fast, because it doesn't have the load the application into RAM. The application is already loaded into RAM! Here's my proposal to make FreeBSD slightly more like Puppy Linux.

      To the best of my knowledge, when FreeBSD boots up it loads the kernel into RAM and any other system required programs, not any applications. Therefore I suggest two different things:

1) When a user clicks on an application, does some stuff, then exits, FreeBSD will NOT unload that application from RAM. Instead it will keep that application loaded in RAM. This means that I could open LibreOffice, wait 5 seconds for it to open, close it, then open it again and LibreOffice would open in a split second.


2) If the user wants this keep-applications-loaded-in-RAM option enabled, they should select a hierarchy of which applications to load into RAM first. For example, I would select Firefox, then LibreOffice Writer, then Banshee, etc. This means when I boot up (after waiting perhaps 20ish seconds?) I can click on Banshee, Firefox, and LibreOffice writer and they would all open up insanely fast, probably in a speed comparable to what SSD drives could deliver.

What do you think?


----------



## Crest (Jul 26, 2011)

That md and tmpfs already support your idea to waste memory for this.


----------



## wblock@ (Jul 26, 2011)

Good news: FreeBSD already does #1.  Here, OOo loads in 8 seconds the first time, 4 seconds the second time.  That's because FreeBSD is caching filesystem buffers.

There's no explicit way to do #2, AFAIK, it's just based on what's in cache.  You could create a RAM disk and run applications from there.

It is possible to run entirely from a RAM disk.  mfsBSD does that.


----------



## phoenix (Jul 26, 2011)

Alternatively, just add the apps you use regularly to the autostart folder in your desktop environment.  That way, as soon as you login, those apps are started and loaded into RAM.  You can even start them minimised, or on a separate virtual desktop so you don't see them. Voila!  Done.  No muss, no fuss, nothing needing to be coded.


----------



## Crivens (Jul 27, 2011)

The "not unloading" bit is called a vnode cache, this is already there and performs really good. It is even faster than the MD because it does not need to copy the content from one memory location to an other.

The other part may be done by pre-loading the cache by adding something like 

```
cat $PRELOAD_FILES > /dev/null
```
to some start entity. That way, the file cache will already have a copy of the files you may want, but will forget about them in case the memory is needed for something else.


----------



## xibo (Jul 27, 2011)

Would it really be faster to copy OpenOffice to mfs and load it from there instead of getting ~1GiB additional memory and having pagerd and the executables and libraries it pages in load only those OpenOffice contents that are actually needed?

And if the case occurs that OOO was not running for some time, and I wish to start it, wouldn't the MFS sections which contained it long have been paged out due to having been the most inactive and largest chunk of memory by then?


----------

