Why linux can be updated without rebooting

Status
Not open for further replies.

subratabera

Just another linux lover.
One of the most frustrating things about installing or upgrading programs on certain operating systems is the constant need to have to reboot. This is especially true with drivers or system files. Why is it that linux can be upgraded without rebooting? Read on to find out.

It all comes down to how linux and the file system handles files. When linux runs an executable it loads the whole file into memory and accesses it from there. This means that there is no connection to the physical file on the disk drive. When the program is closed and all connections to the file are cut the file is deleted from memory.

So while the program is running, from memory, the physical file on the disk can be updated or changed at will and the running program is not affected. If the program is then closed, and the copy is deleted from memory, it can then be started again using the new file version.

This method works with all files on a linux system, including drivers and system files, with the exception of just one file. That file is the actual linux kernel itself and of course it stands to reason that if that file is closed down then the entire operating system is closed down.

To sum it all up every single program on a linux system can be upgraded while the system is running. All that needs to be done to start using the upgraded program is to restart it. The only reason to need a computer reboot is to start using a new linux kernel. There is no other reason at all to need a computer reboot when using linux.

What all this means is that a linux system can be upgraded in real time while it is working and still have a hundred percent uptime. It has been this way with linux from the start while another operating system is still nowhere near this capability even with its latest and greatest(?) release.

Source: *blogs.ittoolbox.com/linux/locutus/archives/why-linux-can-be-updated-without-rebooting-12826
 

mehulved

18 Till I Die............
If the copy of the whole app is stored in the memory how doesn't the memory usage so decent in Linux?
 
OP
subratabera

subratabera

Just another linux lover.
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!
 

gary4gar

GaurishSharma.com
^^
but certainly a irritating one because on every reboot i have to close my torrents:( thats why windows sucks for me
 

Yamaraj

The Lord of Death
This isn't a unique feature of Linux. All Unixen have the same ability to update themselves without rebooting. This is because of the robust UNIX architecture, which has the concept of everything as a file. Windows obviously takes a beating here for its inefficient architecture and design of system internals. Windows registry is a very ugly part of the operating system, which even Microsoft has been thinking about disposing off.

As I've said before, Windows needs a solid UNIX-like kernel. I won't complain this time if Microsoft copied Apple in this regard. ;-)
 

JGuru

Wise Old Owl
@Yamaraj, You are absolutely right. Windows Registry is the culprit!! For the things
to be updated in the Registry, Windows has to reboot.

shashank_re said:
I dont think restarting your PC is tough job!

Suppose you install 15 or 20 applications. And after every application is installed,
you have to reboot!! ie., in total you have to reboot 15 or more times!!
This is more annoying & ridiculous!!
 

planetcall

Indian by heart
The new technology in linux lets you install and use the OS without restarting :) Thats something really cool

*ganjataz.com/01smileys/images/smileys/Cool_Ani.gif
 

aryayush

Aspiring Novelist
Yamaraj said:
This isn't a unique feature of Linux. All Unixen have the same ability to update themselves without rebooting. This is because of the robust UNIX architecture, which has the concept of everything as a file. Windows obviously takes a beating here for its inefficient architecture and design of system internals. Windows registry is a very ugly part of the operating system, which even Microsoft has been thinking about disposing off.

As I've said before, Windows needs a solid UNIX-like kernel. I won't complain this time if Microsoft copied Apple in this regard. ;-)
Yeah, the Macintosh also does not need to be restarted after any upgrade except for kernel updates. It does need a restart after a QuickTime update though, I don't know why.

And Mac goes one step further. Suppose you have a word file open and you are editing it. You can move the physical file around, rename it - do anything except deleting it. This is true for almost every application on the Macintosh. I know it is not possible on Windows but I am not sure about Linux. Does Linux allow you the flexibility to work with busy files?
 
OP
subratabera

subratabera

Just another linux lover.
Yes, you can do it in Linux also, but whenever you move or rename your original file while editing it, a new file is created when you save the file (with original name)...
 

aryayush

Aspiring Novelist
Oh, so Linux basically moves a copy of the file to the location you want to. At least it's much better than Windows.
On a Mac, when you move the file and then save it through the application, it is saved at the moved location - two files are not created. Similarly, when you rename a busy file, the name at the top bar of the application changes to reflect that. :)
 

aryayush

Aspiring Novelist
subratabera said:
That's cool...
Everything about a Mac is, my dear friend!

Desi-Tek.com said:
may be mac save 2nd file in temp folder?
Maybe. I don't know what it does but it does not store two copies of the file on your system.

OS X allows files to be renamed and/or moved to a different location while they are open. The majority of applications will update to reflect these changes transparently to the user, although some applications behave differently. TextEdit, for example, will not recognize the new file name or location, and resaving the file will simply create a brand new version of it in its original location with its original filename (like Linux). Script Editor behaves differently as well. I renamed a script that was open in Script Editor, and was prompted with the following dialog (attached image) when attempting to resave the file.

Most applications, however, will simply reflect the new name in their titlebar as soon as you switch back to the application, and if you've also changed the location, resaving the document will automatically save it to the new location.
 
Status
Not open for further replies.
Top Bottom