mikewalsh wrote: Sat May 11, 2024 12:14 pm
Like you say, ANYTHING you run on a 'puter will use RAM. That's what the stuff is THERE for, after all....but which is actually the most efficient way to use it?
That depends on how you define efficiency, because you can't have it all.
Want low RAM usage? Keep your applications outside of RAM (not inside a SFS that's copied to RAM, not in /tmp, etc') and not in compressed format (so they don't need to be decompressed into a separate region in RAM). The tradeoff is disk space, startup time of applications (because reading from disk is slower than reading from RAM) and possibly slowness at runtime (for example, when an application loads a plugin, an icon or something else from disk).
Want low CPU usage? Don't compress (don't put them inside a SFS) or encrypt (put inside an encrypted directory/file system/partition/volume) your applications and the files they write to, and avoid use of swap (limit RAM consumption, lower swappiness, and avoid use of compressed swap like zram). This comes the cost of disk space and probably RAM (because page cache contains bigger, uncompressed files, and less pages in swap means more pages in RAM), overall system stability and even high risk of data loss (no swap means applications can crash when you're low on RAM).
Want low disk space? Compress everything, preferably within one file (so identical chunks in many files are deduplicated), at the cost of CPU and RAM.
(In my dpup builds, when I have to choose, I trade bigger size for lower RAM usage and lower CPU usage. Space efficiency is the least important kind of 'efficiency' because storage is cheap and upgradable, while CPUs are rarely upgradable or worthwhile to upgrade, and most computers have non-upgradable RAM or a hard limit they reach after one upgrade. And most storage comes in multiples of GB or TB, so if you have enough space for a 300 MB Puppy, you probably have enough space for a 1 GB Puppy, even if this a 2010 netbook.)
BarryK wrote: Sat May 11, 2024 8:04 amEasyOS makes the decision in the initrd whether to copy sfs's to ram based on this:
Code: Select all
FREEK=`grep '^MemFree:' /proc/meminfo | tr -s ' ' | cut -f 2 -d ' '`
Then applies an algorithm, considering media speed (SSD or HDD) also.
Puppy has a similar formula and it prioritizes SFSs if RAM is too low (see https://github.com/puppylinux-woof-CE/woof-CE/pull/3783).
Future dpup builds of mine (see https://github.com/vanilla-dpup/woof-CE ... onsumption) add even more 'efficiency' improvements:
1. This copying is disabled by default if booting from a SSD (very little observable difference when booting from my 9 years old, relatively slow SATA SSD) - the downside is that you can't unplug the flash drive you're live booting from
2. There's no copying really - instead, the SFSs are locked into page cache
3. This locking happens in the background with low priority, while the boot process continues (much faster boot) and if the boot media is super slow it continues while you're already in your graphical desktop and doing your stuff
4. If running low on RAM, the processes that hold the SFSs cached in RAM volunteer to release this memory, it's a win-win situation: SFSs stay in RAM if you have enough RAM, otherwise this RAM is freed automatically and it's not 'reserved'