Why Linux can be updated without rebooting

I have read an interesting blog regarding the topic of awesome mechanism built-in any Linux. Why Linux can be updated without rebooting? This is a feature of UNIX-like operation system as well as its filesystem implementation.

kelvie wrote:

Wow, I'm not sure that this is really how it is done (with most UNIX file systems anyways). The entire file is NOT loaded into memory, they are read into buffers in clusters (which is a technical term, it's typically 4k, but you can set it when setting up your filesystems).

When you open a file, the kernel follows the link, and assigns the inode a file descriptor (a number that it keeps track of internally). When you delete the file, you are "unlinking" the inode; the file descriptor still points to it. You can create a new file with the exact same name as the old file after deleting it, effectively "replacing" it, but it will point to a different inode. Any programs that still have the old file open can still access the old file via the file descriptor, but you have effectively upgraded the program in place. As soon as the program terminates (or closes the file), and starts up (or tries to access it again), it accesses the new file, and there you have it, a completely in-place replacement of a file!

Tags: ,

Post new comment