Why linux can be updated without rebooting

Discussion in 'Open Source' started by subratabera, Nov 11, 2006.

Thread Status:
Not open for further replies.
  1. subratabera

    subratabera Just another linux lover.

    Joined:
    Jun 6, 2006
    Messages:
    564
    Likes Received:
    26
    Trophy Points:
    0
    Location:
    Bangalore, KA
    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: http://blogs.ittoolbox.com/linux/locutus/archives/why-linux-can-be-updated-without-rebooting-12826
     
  2. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    Yea thats rite!
     
  3. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    I think Microsoft can learn something from this!!!
     
  4. hard_rock

    hard_rock Salieri Family

    Joined:
    Feb 24, 2004
    Messages:
    365
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Somewhere in Internet.......Have dynamic IP addres
    Thanx 4 da information.. I never thought about this.. One new doubt cleared.
     
  5. phreak0ut

    phreak0ut The Thread Killer >:)

    Joined:
    Apr 2, 2006
    Messages:
    1,181
    Likes Received:
    6
    Trophy Points:
    0
    Location:
    Bangalore
    Thanks for the great info. Linux rocks all the way :)
     
  6. OP
    OP
    subratabera

    subratabera Just another linux lover.

    Joined:
    Jun 6, 2006
    Messages:
    564
    Likes Received:
    26
    Trophy Points:
    0
    Location:
    Bangalore, KA
    Thanks friends. Linux rocks in many more areas also...You just have to discover it...
     
  7. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    If the copy of the whole app is stored in the memory how doesn't the memory usage so decent in Linux?
     
  8. OP
    OP
    subratabera

    subratabera Just another linux lover.

    Joined:
    Jun 6, 2006
    Messages:
    564
    Likes Received:
    26
    Trophy Points:
    0
    Location:
    Bangalore, KA
    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!
     
  9. shashank_re

    shashank_re Member

    Joined:
    Oct 27, 2006
    Messages:
    429
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bangalore
    I dont think restarting your PC is tough job!
     
  10. gary4gar

    gary4gar GaurishSharma.com

    Joined:
    May 21, 2005
    Messages:
    4,094
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    Jaipur
    ^^
    but certainly a irritating one because on every reboot i have to close my torrents:( thats why windows sucks for me
     
  11. hard_rock

    hard_rock Salieri Family

    Joined:
    Feb 24, 2004
    Messages:
    365
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Somewhere in Internet.......Have dynamic IP addres
    Note the fact that LINUX is mostly used for SERVERS and servers need 100% Uptime...
     
  12. Yamaraj

    Yamaraj The Lord of Death

    Joined:
    May 11, 2005
    Messages:
    253
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    यमलोक
    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. ;-)
     
  13. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Yamaraj, You are absolutely right. Windows Registry is the culprit!! For the things
    to be updated in the Registry, Windows has to reboot.

    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!!
     
  14. planetcall

    planetcall Indian by heart

    Joined:
    Nov 26, 2003
    Messages:
    343
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Bangalore
    The new technology in linux lets you install and use the OS without restarting :) Thats something really cool

    [​IMG]
     
  15. aryayush

    aryayush New Member

    Joined:
    May 6, 2005
    Messages:
    5,594
    Likes Received:
    20
    Trophy Points:
    0
    Location:
    Noida
    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?
     
  16. OP
    OP
    subratabera

    subratabera Just another linux lover.

    Joined:
    Jun 6, 2006
    Messages:
    564
    Likes Received:
    26
    Trophy Points:
    0
    Location:
    Bangalore, KA
    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)...
     
  17. aryayush

    aryayush New Member

    Joined:
    May 6, 2005
    Messages:
    5,594
    Likes Received:
    20
    Trophy Points:
    0
    Location:
    Noida
    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. :)
     
  18. OP
    OP
    subratabera

    subratabera Just another linux lover.

    Joined:
    Jun 6, 2006
    Messages:
    564
    Likes Received:
    26
    Trophy Points:
    0
    Location:
    Bangalore, KA
    That's cool...
     
  19. Desi-Tek.com

    Desi-Tek.com New Member

    Joined:
    Oct 15, 2006
    Messages:
    370
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Mumbai
    may be mac save 2nd file in temp folder?
     
  20. aryayush

    aryayush New Member

    Joined:
    May 6, 2005
    Messages:
    5,594
    Likes Received:
    20
    Trophy Points:
    0
    Location:
    Noida
    Everything about a Mac is, my dear friend!

    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.
     
Thread Status:
Not open for further replies.

Share This Page