You are not logged in.

#1 2020-05-10 18:22:08

cdwijs
Member
Registered: 2010-04-24
Posts: 185

Dividing the ram into program and data memory to keep a fast system

Hi all,

Suppose I have a very slow hard drive (or even a CD) that has high seek times. In that scenario, it's important to keep only in RAM what matters for the responsiveness of the system.

Ideally, I would like to partition my memory. For instance 3/4 of my ram is for programs, and 1/4 for data. When the data cache runs out, if can push out old data, but it can never push out old programs. The same for the program cache, it can never push out old data. I think this way my machine stays more responsive.

Does such a thing exist?

Cheers,
Cedric

Offline

#2 2020-05-10 18:26:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,222
Website

Re: Dividing the ram into program and data memory to keep a fast system

Ah, yeah, that's what the kernel does.  It doesn't keep cache around if there is not space for it - but it also will not drop cached data for no reason.

Perhaps you are interested in swapiness settings if you are using swap (to ensure data isn't swapped until after all file caches have been dropped to make space), but even there I suspect the defaults will suit you well.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-05-10 18:35:30

cdwijs
Member
Registered: 2010-04-24
Posts: 185

Re: Dividing the ram into program and data memory to keep a fast system

Thank you, the swappiness settings controls the flow of stuff in the memory to and from the swapfile.

But I was talking about a memory cache system that knows the difference between executable code, and data. Does the kernel know about this difference?

Offline

#4 2020-05-10 19:00:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,222
Website

Re: Dividing the ram into program and data memory to keep a fast system

Of course it does, the kernel is what maintains the cache and loads and executes code.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2020-05-10 19:18:38

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,014

Re: Dividing the ram into program and data memory to keep a fast system

I know how you feel, here's my recipe:

I wrote gopreload years ago, it can help you because it maps and locks the programs you want into memory.
Kernel won't move them to swap partiton, so you've to think in advance to a restricted set of tools you really need to be responsive.
https://wiki.archlinux.org/index.php/Preload

Also, you can hibernate instead of powering off (with or without gopreload).
Doing that allows you to retain part of the buffers between runs so that your system is more reactive right after powering on subsequent times.
Using uswsusp from aur allows you to compress the hibernation image, i'd use it.
https://wiki.archlinux.org/index.php/Uswsusp

Next comes zswap, a way for the kernel to compress swap pages and keep them in ram.
It really helps when the system is low on free memory.
https://wiki.archlinux.org/index.php/Zswap

Offline

Board footer

Powered by FluxBB