writing to global variable in shared object file will increase memory usage

Yubin Ruan ablacktshirt@gmail.com
Thu Aug 31 13:54:00 GMT 2017


I know that on many operation systems (almost all) many user programs
which use the same shared object file will effectively use the same
piece of memory for that object file, as long as user programs does
not write to that piece of memory, in which case a Copy-On-Write will
be triggered.

So, I wonder, if many user programs use the same shared object file
and all those programs try to write a global variable, will the
operating system duplicate that shared object for all those programs?
Or just the part that got written? How to verify that?

Thanks,
Yubin



More information about the Libc-help mailing list