05

September
2012

Double RAM with zram

Slax will use zram technology. In my tests, I was able to run fully bloated KDE on a computer with only 256MB of RAM.

What zram does? It provides virtual block device in memory, which is compressed. If Linux is set up to use that compressed block of memory as swap, it can put there all currently unused blocks of memory (effectively compressing them).

It is a bit slower indeed, but the value added is enormous, since that way huge applications (like KDE) can run on computers where it would not run at all without zram. If I trim down KDE as I plan to do, it may be possible to run it on 128MB systems, that is actually my goal; not sure if it is possible, but will try.

Current system requirements for Slax pre-alpha test are:

Slax 32bit ... minimum 40MB of RAM required
Slax 64bit ... minimum 52MB of RAM required

If you wish to test zram on your computer, modprobe 'zram' module first, then echo some value like 50000000 to /sys/block/zram0/disksize, and finally mkswap and swapon the device /dev/zram0.

Thanks to Quax (Manfred Mueller) for this suggestion.

User comments
FIRST 2012-09-05 04:28

FIRST

Tomas M 2012-09-05 04:34

First idiot :)

Drago 2012-09-05 05:01

:D
Very good news to me. Actually, it is very good, in nowadays, when there is people, who thinking about optimization. in that times popular is thinking like "i make an tetris -its system requirements is 64 terabytos of ram, 256 procesors cray supercluster, and so on, but in nowadays processors and ram is cheap, as so that is ok...". with nostalgy remember wing commandert, who runs on 286 machine with 12 mhz and 1 mb ram, and looks great for that time, also demoscene in 64 kbytes packed beautiful graphics and sound, and so on...

Jamal 2012-09-05 06:12

I like the zram method.

If it gives full applications support in old slax i used to face black out screen if i open many applications

I had to restart it to fix the problem.

Good to see you working on slax keep up with good work.

Jason 2012-09-05 17:33

Is it also possible for Slax to scan for swap partitions on the hard disk and use them too, if available.

Eg: When running slax from a livecd, the host computer may be already having an existing Linux installation on its hard disk with a swap partition. So maybe Slax can probe and use this swap partition also?

Tomas M 2012-09-05 18:36

@Jason:
I am not sure if using the swap partition automatically is a good idea. Imagine a situation when there is a hybernated Linux OS and it uses the swap. If Slax boots on such computer it would overwrite the swap, effectively destroying data of the hybernated OS.

Jason 2012-09-05 19:05

Ok, got it. Thanks!

fanthom 2012-09-06 22:00

I'm not trying to be a smart ass but must say that 512KB blocksize for modules + ZRAM + KDE4 is probably not a good idea. At least it wont work for all scenarios.

All these features requires strong CPU's and Slax will more than likely be installed also on Atom based netbooks (or netbooks in general) which has sufficient amount of RAM but weak CPU. Even now i can hear slax 7 users complaining about the speed.

I would consider providing slax with doubled desktop which could solve low specs PC's issue:
a) KDE4 for modern PC's with strong CPU's
b) LXDE (or even openbox) for modern PC's with weak CPU's or old PC's with low specs.

1) LXDE is extremely small - 3.5 MB module as of the latest Porteus version so no harm at all to add it to the ISO.

2) LXDE is evtremely fast and takes marginal amout of RAM after boot.

3) Finally (and most importantly): on the "users preferred desktop" poll organized on our forum LXDE beaten up KDE4.

I wouldn'd resign from KDE4 totally as it's definitely a best choice for novice users. I want to show that LXDE could fill the low PC's hardware niche perfectly.

I'm not trying to bash the ZRAM idea which may be good in some scenarios. Rather trying to show that there are better alternatives for PC's with low RAM amount.

In my opinion LXDE as second (fallback?) desktop is definitely worth consideration.

Cheers

Tomas M 2012-09-07 09:38

Thank you, I will consider it.

fanthom 2012-09-07 20:13

If you care about qt more than gtk then Razor-qt may be a better alternative to LXDE:
http://www.razor-qt.org/screenshots/

I have never built Razor-qt myself so can't say if it's ready for production at this stage.

btw: my apologize for spamming ZRAM thread with unrelated posts.

kurp 2012-09-09 22:23

ZRAM sounds interesting (Does it really work? I've never heard it before), however fanthom may be right - providing Slax with some lightweight alternative desktop may be the best solution.

To be honest, I've used previous versions of Slax on many machines (even today I have Slax-flash in my pocket:) and in case of some of them KDE was a bit to heavy...

Jason 2012-09-18 19:25

Will you be keeping the memory allocated for zram as static or will you later configure it dynamically based on the system memory?

Also for multicores will you be configuring disksize for each of the cores? (/sys/block/zram0/disksize, /sys/block/zram1/disksize .. etc)

Tomas M 2012-09-18 20:24

I decided to skip multi-core optimalizations since it seems not necessary. If you have several cores, you have probably much more RAM than 512MB and thus you will not need zram at all (it won't even start swapping to it, since you'll have a lot of memory already).

Also I won't change the size dynamically. If you are low on RAM, then the default 512MB size (virtual size) is much more than enough. And if you have lots of RAM, then you won't need it at all thus keeping it at 512MB seems reasonable.