What happens in linux when a dynamic library is updated on disk
What happens in linux when a dynamic library is loaded, updated on disk, then a new process is sta开发者_C百科rted that links to that library? Is the new process linked against the old in memory copy or the newer version on disk?
When package managers update files on disk, they actually delete the old file and write a new file in its place. The result is that, old applications which had already opened the library, continue to see the old one -- the old file still exists on disk and in memory, but has no file names pointing to it anymore. These kinds of files are called orphans.
Meanwhile, applications started after the library was replaced, start using the updated version of the library.
This is why, after a power loss, you sometimes see the following messages in logs or during bootup:
EXT4-fs (sda3): 34 orphan inodes deleted
The old system was still accessing these files as it crashed, but they aren't visible to applications anymore, so they should be deleted.
精彩评论