How can Ubuntu update running applications without having to close them while Windows cannot?

Running Ubuntu 12.04 64-bit.

I mostly update through terminal using sudo apt-get update && sudo apt-get upgrade.

I don't understand this: having Firefox or any other such integrated application actively running along with update process running concurrently in terminal, which is updating Firefox to a newer version. I am aware that restarting Firefox will cause Firefox to be opened as the newer version.

For example, when updating in MS Windows 7, it asks for closing the active instance of the same application (if it is active) before updating.

How does Ubuntu replace the active working application to a newer version without interfering with its active instance?

What exactly happens at the back-end of updating process in this case?


Solution 1:

For Example-Updating in MS Windows 7 , it asks for closing the Active Instance of same application (if active) for updating.

How does Ubuntu replaces the active working application to newer version without interfering with its active Instance. [Noticed for many Packages]

I'll try to explain this as simply as possible. Most Linux filesystems are slightly different from Windows' filesystems (NTFS). At their core, both essentially contain an index table of file names (entries) pointing to the actual data stored on the disk. In NTFS this is called the MFT (master file table) -- you may have seen that name scroll by if you run a chkdsk.

However, the "slight difference" I mentioned is that Linux's index tables, if you will, consists of two levels: the index, and inodes. The inodes contain the actual file metadata, including its physical location on disk; the "file name" in the index is simply a (hard) link to the inode.

When you update/upgrade a running application, the updated files are written to disk, inodes pointing to the new data created/updated, and the file names are also updated to link to these new inodes. But, for any files that already in use by a running application (i.e. file handles exist), their file names will continue to point to the old inodes (which contain the old data) until the file handles are closed. This usually happens when you exit the application, or for some system files, when you reboot. At this point, the old data is actually removed from your disk.