strace, it appears to me that
libc.so.6 are opened and mapped to memory for almost every process. At least those processes that I experimented with. Doesn't this mean that these processes are mapped into process memory many many many times?
Sure, these files are pretty small, but isn't that a little wasteful of memory?
The strace output shows that these are being mmap'ed with
MAP_PRIVATE set, which makes it copy-on-write, but there still appears to be a new mapping for every process.
- Have I properly understood what is happening? That is, is there really a new copy of these files mapped into memory on every process that needs them (which appears to be every single one)?
- Is there some type of memory-sharing going on? That is, since the mapping is copy-on-write, are lots of processes looking at the same physical memory locations?