Why Does Windows Need a Restart After and Update but Linux Doesn't?

One of the major reasons is the difference how open files are handled in linux and windows. Some linux experiment:

  • Open a terminal and run ping www.google.com > googleping.txt (Command chosen because it gives a constant output)
  • Open a second terminal and run tail -f googleping.txt...this shows you the content of the googleping.txt file updated all the time by new ping lines
  • And now to the fun part...open a third terminal and run rm googleping.txt...we just deleted the file that the first shell writes to and the second shell reads from...and nothing happens. Both shells happily continue their work and you get the output still displayed and growing.

In linux a file only get removed if the last handle to the file stops existing. By deleting a file with rm you remove one of those handles...but if there are open programs still accessing the file they can..the file still exists as long as the handles of those programs are still valid.

In windows this is different (usually, this is simplified a bit). If something accesses a file the file gets locked and can't be deleted. This is what makes updates "interesting"..simple example, a program currently runs and has its icon files open to display them in the menu...so now the icon files can not really be updated as they are locked. To get around this you can do it in two stages...you write the update to the program somewhere temporary and in a second stage you overwrite the actual program with that temporary copy when you can be sure the program is not running. As there are several programs/processes running from a very early state of the OS the only "sure" way is doing those updates right before a shutdown or directly after a reboot...before the programs are started or after they are closed.

In Linux this is not necessary as files are not locked and you can overwrite them at any time. But this has it's own set of problems...as seen in the very first example the tail -f keeps on using the file...even if you would create a new file with the exact same name it wouldn't change to that new file. This means that you can do updates during a running system...but the programs currently running will not notice them at once. You still have to restart the programs...and it can be rather tricky as well to figure out what programs need a restart and to do so (Update to Xorg needs Xorg restarted meaning all graphical programs will loose the connection to Xorg...so basically you have to restart everything above the pure text interface in this case. For system services this can get even worse and the outcome being almost the same as a reboot.)

Oh..and then there is of course kernel updates. While there are some techniques to do kernel patches without a reboot there is no real way around rebooting for major kernel updates.

If you have any comments, feel free to post them below or find us on Twitter and Facebook!

-Until next time!

January 07 2020

Add or review comments

Please leave your comment

Existing comments

Comments 0


Get notified about new publications and product updates.
Please note we do not share information to anyone.