r/programming • • Feb 06 '19

Visual Studio Code: January 2019 (version 1.31)

https://code.visualstudio.com/updates/v1_31
790 Upvotes

340 comments sorted by

View all comments

Show parent comments

134

u/Veranova Feb 06 '19

Now I only have to restart Windows every time!!! /s :D

50

u/Ameisen Feb 07 '19 edited Feb 07 '19

A ton of software complains like twenty times that I need to restart Windows if I don't close certain apps during an installation... Then it works fine and doesn't bother me any more. The only things that usually require restarts are certain Windows Updates.

I presume it's due to the fact that Linux lets files be modified while opened/loaded/being executed. Windows locks them (as they memory map them with a lock)... So Linux can update files without forcing things to stop (though that can break things badly). Windows has to restart to clear all the file locks that the system itself has.

Which is also odd, as NT being a hybrid kernel is far less 'integrated' and monolithic than the monolithic Linux kernel.

Ed: to clarify, Linux generally memory maps executables/libraries as copy-on-write. You can modify/delete executables while they are running, and it won't impact the current execution. However, if you update a shared object with a new one with a new ABI, and a currently - executing program loads it presuming it is the same as before... breaky-breaky-time. Try updating glibc on a Linux system, one library at a time. The entire system will stop functioning at all before you are a third complete. Also, interestingly, file locking is and has been competely broken in Linux.. well, forever. It's always a good idea to memory map files on Linux as copy-on-write for reads so that they don't inexplicably change on you while you are reading them. The kernel may do that for you now internally, though.

17

u/RirinDesuyo Feb 07 '19

Yeah I think the locking and filesystem behavior is the reason for it I pressume. Though if I recall the new iteration for Windows (Windows Core OS) is gonna mitigate that somehow by creating an identical image of the OS and updating that instead then hot-swapping them on restart. Don't quote me on that though I heard in from an article somewhere I forgot sadly xD

10

u/G00dAndPl3nty Feb 07 '19

I think the main reason is actually due to the registry. Updates to some entries are not visible until after rebooting

2

u/cat_in_the_wall Feb 08 '19

it's not a hotswap if you reboot. what they'll do is basically have them side by side, and on a reboot it just uses the new stuff.

13

u/phire Feb 07 '19

If I was Microsoft, I'd be focusing on minimising the amount of time the restart takes during an update. Do as much as possible in the background while the computer is running, then just swap all the files on the reboot. Should only take a few seconds.

Sure, having to restart is annoying. But what really pisses people of are restarts that take 10-30min.

25

u/IceSentry Feb 07 '19

That's pretty much what they are already doing

5

u/iphone6sthrowaway Feb 07 '19

While Linux sytems tend to be more lightweight (or less featureful, if you prefer) than Windows, upgrades take way less time to install than on Windows and the time to reboot is the same as any other reboot. The downside is that a few programs don't handle the underlying files being replaced on-the-fly and may break/crash.

I think that NixOS (an 'unusual' Linux distro) has the most futuristic update system I've seen so far. It can save multiple system configurations and almost instantaneously swap them either live or in a reboot, so that e.g. you can launch an update, keep working for however long you want without anything breaking, then when you reboot it will load the updated system without any extra delay. It can also load an old system configuration ('rollback' the update) in seconds as well.

4

u/IceSentry Feb 08 '19

As was somewhat explained previously, windows takes longer to reboot after an update because it needs to make changes to files that were locked while the computer was running. This is mostly for legacy/security reasons as far as I understand. Linux reboots faster because it doesn't need to do anything special while rebooting.

2

u/vetinari Feb 07 '19

Fedora Atomic / Fedora Silberblue with their ostree can also do that; with the upside, that you don't have weird paths, or have to recompile the world when something at the root of dependency tree changes.

2

u/clgoh Feb 07 '19

That's pretty much how Chrome OS works.

2

u/cat_in_the_wall Feb 08 '19

chrome os is a Linux

4

u/Schmittfried Feb 07 '19

I slightly disagree. Yes, of course 10-30min restarts are really off-putting (I'd say they are quite unacceptable when you are currently doing important work), but any kind of forced disruption is already annoying in and of itself, no matter the duration. And it doesn't exactly help that Windows does a clean restart so you have to reopen all your apps afterwards. Even on macOS I find restarts annoying, but at least I will be (almost) exactly where I left off.

1

u/jl2352 Feb 07 '19

They do that already. My PC does a full restart in about 10 seconds.

4

u/elint Feb 07 '19

Not for the restart after an update.

2

u/Limelight_019283 Feb 07 '19

So does windows create copies of the modified files and deletes the previous ones on restart? Or just queues the required modifications to be done on next startup?

5

u/Ameisen Feb 07 '19

It reboots into a mode where nothing is really loaded, and then installs as the files aren't locked.

For something that would still be locked, like the kernel, I presume they mark some flag as "needs update", and ntldr probably copies it.

Technically, I also have no doubt that the kernel is capable of memory mapping a file without a lock, so they may take advantage of that as well.

The NT kernel even has fork, iirc. It's just not exposed directly as a system call.

2

u/caspper69 Feb 07 '19 edited Feb 08 '19

Yes, NT has a fork analogue- calling ntCreateProcess with a null executable handle forks the calling process. The problem is the forked process loses its handles to Win32, which does not support fork. So, WSL, for example, can use the fork functionality provided by the NT kernel, but a regular Win32 application cannot.

Edited later to add: win32 likely has no concept of forking a process because Win95/98/ME did not support such a system call, neither did the windows/dos iterations prior.

2

u/cat_in_the_wall Feb 08 '19

wsl is super interesting. its rad that as far as nt is concerned, wsl is an equal citizen to win32: just subsystems.

2

u/caspper69 Feb 08 '19

Honestly, it goes to show the foresight and engineering that went into NT. There's not a ton of love for MS, with the rise of Linux, but the NT kernel has proven to be pretty flexible (many arch, many subsystem support). I'd like to think if they can get a handle on the filesystem problems (which are an absolute albatross all the way around right now), it'll still be holding up remarkably well. Especially considering its development began 30 years ago (wow :/).

2

u/cat_in_the_wall Feb 08 '19

i suspect part of it has to do with timing. I'm sure you're aware of the history of nt (and if not, it's a fascinating rabbit hole to go down), but at that time the landscape was still shifting sands. so the requirement was there from the get-go to build something extremely flexible. those folks came up with some extremely durable software.

2

u/Ameisen Feb 08 '19

It's not as though NTFS is particularly terrible, either.

As I recall, one of the biggest causes of filesystem performance problems on NTFS is the same thing people point out is better than on Linux - the permission systems. When a file has trivial permissions like on Unix, access is trivial. When you have full, potentially inheriting ACLs like NTFS... you may have to do quite a bit of traversal before the VFS determines that you have access.

→ More replies (1)
→ More replies (1)

10

u/nemec Feb 07 '19

Can't you just install VSCode inside WSL and use an X-forwarder to display the UI on your Windows desktop? :D

https://www.scivision.co/x11-gui-windows-subsystem-for-linux/

7

u/Veranova Feb 07 '19

Modern solutions for modern problems!

→ More replies (7)