Hello :),

I'm not an expert of kernel and architecture,
but I do know some things.
For example, I know that Linux keeps frequently accessed files in RAM,
and that when writing there are options to ensure that
the write finishes only when the file was modified on the HDD, SSD.
(More or less since there is a cache also at the SSD,
and if I remember correctly,
databases software editors sell servers with a custom OS,
an enormous amount of RAM and their software
to bring better guarantees to the security/validity of data (in case
of failure)).

When coding bash scripts,
I saw (without precise measure)
that my code executed faster when I merged consecutive commands into one.
In particular for sed (using repeated -e)
that, I admit, is not in coreutils,
a single sed command was faster than
consecutive sed commands.

I do know that it is something that is well-known,
since it is the reason it is recommended to use Bash or other shells
builtins, when possible, instead of spawning a new process.

But I wondered :
- if the cost is mainly to copy the code in machine language
(executable, ELF in case of Linux) to the RAM or the cache,
- and if so if there was something in Linux or on some CPUs
(AMD?, Intel?, server CPUs?) such that some files can be kept "forever"
in L3 Cache since today CPUs L3 Cache is enormous on some
CPUs, it would logic that the kernel and the core utils
are never removed from the L3 cache to go the RAM.
It's kind of a mixte mode between Von Neumann architecture
and Harvard architecture,
where executable code compared to data would have
a privileged mode to stay in cache.

Does anybody knows if such a thing exists ?
If not, I think it would be a good idea FOR PERFORMANCE.
It may be a bad idea for SECURITY
because the addresses would always be the same
(I'm not an expert of that, that's just my "general specialized" culture
in informatics that makes me think that.)

Best regards,
    Laurent Lyaudet

Reply via email to