The article never mentions speed (or performance) again. Is the OS somehow expected to be faster because it is mounted read-only?
The article never mentions speed (or performance) again. Is the OS somehow expected to be faster because it is mounted read-only?
How many libraries are loaded:
$ sudo cat /proc/[0-9]*/maps | grep '\.so' | grep 'r-xp' | tr -s ' ' | cut -d ' ' -f 6 | wc -l
15429
How many unique library names: $ sudo cat /proc/[0-9]*/maps | grep '\.so' | grep 'r-xp' | tr -s ' ' | cut -d ' ' -f 6 | sort | uniq | wc -l
872
Top 10 most shared libraries: sudo cat /proc/[0-9]*/maps | grep '\.so' | grep 'r-xp' | tr -s ' ' | cut -d ' ' -f 6 | awk '{count[$0]++}END{for (i in count) print i, count[i]}' | sort -k 2 -n -r | head -n 10
/lib/x86_64-linux-gnu/libc-2.28.so 299
/lib/x86_64-linux-gnu/ld-2.28.so 299
/lib/x86_64-linux-gnu/libdl-2.28.so 262
/lib/x86_64-linux-gnu/libpthread-2.28.so 237
/lib/x86_64-linux-gnu/librt-2.28.so 227
/lib/x86_64-linux-gnu/libuuid.so.1.3.0 205
/lib/x86_64-linux-gnu/libz.so.1.2.11 200
/lib/x86_64-linux-gnu/libpcre.so.3.13.3 186
/lib/x86_64-linux-gnu/libresolv-2.28.so 170
/lib/x86_64-linux-gnu/libgpg-error.so.0.26.1 169
EDIT: add grep r-xp to count code segment only, values in previous edit were overestimated.The GP did mention the 'big graphical ones,' but the amount of memory that gets saved was a bit stunning the first time I saw it.
It's not easy to share libraries across containers, unless they can be built to share a base layer in a stacked union filesystem approach.
Well, in my original post (GGGP) I've defined "a library" as "a .so file" so what I can say is that the 872 distinct .so files used on my laptop will be shared among the different processes that use them.
If you assume the same library can be duplicated in two different .so files, then 872 is just an upper bound on the number of distinct libraries and further sharing could be done.
Eitherway, that is a significant amount of code sharing, which was the original question in this thread.
If the containerised versions of apps all have different versions of dependencies (quite likely IMO as they'll have the freedom to), there won't be any sharing.
On top of that, ostree does deduplication based on file checksum. So if different packages ship the same binary, it will be only one copy on the disk and again, the mmaped regions will be shared among processes.