23 votes

Call me crazy, but Windows 11 could run on Linux

Tags: linux, windows

36 comments

  1. [20]
    frostycakes
    Link
    I'm far from an expert in this, but from my understanding, the NT kernel itself isn't "bad", and does some things better than Linux/other Unix-like kernels (and vice versa). I'd see Microsoft open...

    I'm far from an expert in this, but from my understanding, the NT kernel itself isn't "bad", and does some things better than Linux/other Unix-like kernels (and vice versa).

    I'd see Microsoft open sourcing the NT kernel (maybe going to a model similar to Apple with XNU and their various OSes) before switching to being fully Linux-based internally. So much of their business is built on backwards compatibility, and the amount of hardware out there, especially in some specialty environments, that only has Windows drivers that can't be covered by Wine or a Wine-esque solution, would preclude a full kernel switch.

    Unless they developed a kernel module that could act as a shim to enable Windows drivers (and I imagine the amount of work required to get that working to be significant), they'd be shooting themselves in the foot IMO.

    15 votes
    1. [18]
      Elronnd
      Link Parent
      From what I hear, getting windows drivers to work natively in the linux kernel would not be an inordinate amount of work. It's just that no one is interested to do that. NT is a solid kernel, it's...

      From what I hear, getting windows drivers to work natively in the linux kernel would not be an inordinate amount of work. It's just that no one is interested to do that.

      NT is a solid kernel, it's true. But, ultimately, I think the philosophy behind the unix-style kernels is better. It would be ok to delete a file that's open in another process. It should be possible to fork(). Now, you could say that fork() (and things like that) is a hack, and I think that's legitimate. But you could also say that the unix process model is more flexible and powerful, and that the kind of things that are enabled by the windows process model are not necessarily desirable.

      8 votes
      1. imperialismus
        Link Parent
        Getting all the Windows drivers to work natively in the Linux kernel would certainly be an inordinate amount of work. Windows supports a large amount of hardware. As for fork, Microsoft seems to...

        Getting all the Windows drivers to work natively in the Linux kernel would certainly be an inordinate amount of work. Windows supports a large amount of hardware.

        As for fork, Microsoft seems to agree that it’s a hack, and just not worth it. There is posix_spawn that does what you actually want to do 99% of the time with fork/exec, and the last 1% may not be worth it. There’s a lot of historical choices made that were sensible at the time, but later became enshrined as eternal wisdom in order to justify their continued existence even when they seemed more costly than elegant. Windows surely has a lot of these, being ultra-backwards compatible, but Linux certainly does as well, being spiritually compatible with an even older OS.

        8 votes
      2. [10]
        zaarn
        Link Parent
        fork() is quite a terrible primitive; it does a lot of work under the hood that's almost perfectly contrary to the KISS principle. Ideally you'd use posix_spawn or other calls that let you adjust...

        fork() is quite a terrible primitive; it does a lot of work under the hood that's almost perfectly contrary to the KISS principle. Ideally you'd use posix_spawn or other calls that let you adjust how memory, resources and everything else is handled. Because 99.99% of the time the defaults that fork uses are bad for performance or security and only in 0.01% of cases (being shell scripts being run by a shell spawning a subshell), you want what fork() does.

        "Everything is a file" has also turned out to be not quite that useful. The modern Linux driver stack uses a file to access the GPU, but only really to get the resource handle, then everything moves to special ioctl() calls and memory mapping because files are terrible at being able to do what a GPU does.

        Even a simple printer already has different primitives to a file (can't read, can't seek, only write), so IMO Windows isn#t entirely wrong in making these things a separate API that can be more clear and powerful without having to to haggle yourself through the filesystem.

        Of course, not to detract, some parts of Windows OS are fairly terrible, yes.

        7 votes
        1. [2]
          Elronnd
          Link Parent
          That's an API failure. There is no fundamental reason why the gpu can't be accessed without ioctls. Files shouldn't be something you have to 'haggle through'; linux designers just don't quite do...

          "Everything is a file" has also turned out to be not quite that useful. The modern Linux driver stack uses a file to access the GPU, but only really to get the resource handle, then everything moves to special ioctl() calls and memory mapping because files are terrible at being able to do what a GPU does.

          That's an API failure. There is no fundamental reason why the gpu can't be accessed without ioctls.

          Files shouldn't be something you have to 'haggle through'; linux designers just don't quite do the right thing with them. Look at plan9 for a better example of what everything-is-a-file should be.

          Just recently I had an instance where fork() was pretty much exactly what I needed, and I ended up not being able to deploy that relatively simple solution because it doesn't work on windows. That's not even my point, though, really; my point is that the unix process model as a whole is simpler and more powerful than windows'. Completely aside from whether you think any individual thing you do with it is justified or not. This is like how lisp is simpler and more powerful than java--that allows you to do stupid hacks with lisp, and it might be debatable whether those are stupid hacks, but the fact that you can do them doesn't reflect poorly on lisp.

          4 votes
          1. zaarn
            Link Parent
            The unix process model is overloaded IMO, it could be much much simpler (only tasks, making them lightweight enough that they can double-duty as threads or process), then you can build more...

            The unix process model is overloaded IMO, it could be much much simpler (only tasks, making them lightweight enough that they can double-duty as threads or process), then you can build more complex models on top that suit your needs. In that model, fork() would be a heavy handed function with no purpose other than sugaring much more low level process creation (in Linux, the fork() syscall simply runs the appropriate proper syscalls in the background. There is no native fork() in the Linux process model).

            And I hate to be that guy, but plan9 might be functional and have some good ideas, but it's terrible and writing drivers for plan9 is even more terrible because files are simply not a good abstraction for anything but actual files in a filesystem on a disk. Even networked filesystems like NFS start to creak the model of "everything is a file".

            Similar LISP might be powerful and one of the most beautiful languages concepted but the reality is simply that most people don't use it, even after they grasp the concept because other languages provide better models out of the box.

            The reason the GPU is access with ioctl's and memory mapping is becase the performance of read()+write() is not nearly sufficient to shovel multiple gigabytes per second to the GPU, as is necessary to drive modern GPUs. A GPU is not a printer, it's an entirely self-contained computer that must be entirely controlled by the driver to work properly. It doesn't even remotely work like a normal CPU, hence a simple file operation already doesn't cover what is necessary.

            3 votes
        2. [7]
          ubergeek
          Link Parent
          Sometimes, that's exactly what you want in a file: Write only as append, and no read.

          Even a simple printer already has different primitives to a file (can't read, can't seek, only write)

          Sometimes, that's exactly what you want in a file: Write only as append, and no read.

          1 vote
          1. [2]
            Wes
            Link Parent
            One example might be a sensitive log file. If the log can be edited in full, a hacker could cover up their tracks.

            One example might be a sensitive log file. If the log can be edited in full, a hacker could cover up their tracks.

            2 votes
            1. zaarn
              Link Parent
              You can do that properly by blocking syscalls like seek() or open() (optionally only blocking non-appending modes) or remove() so that you can only write to the end of the file.

              You can do that properly by blocking syscalls like seek() or open() (optionally only blocking non-appending modes) or remove() so that you can only write to the end of the file.

              1 vote
          2. [4]
            zaarn
            Link Parent
            Yeah but a printer is not a file, it's a machine. A teletyper behaves like a file, a printer does not. Modern printers have many more functions than "print text to file".

            Yeah but a printer is not a file, it's a machine.

            A teletyper behaves like a file, a printer does not.

            Modern printers have many more functions than "print text to file".

            1. [3]
              ubergeek
              Link Parent
              Yep. They have a read, no seek file, to scan and receive faxes; a write, no read/seek to send faxes; and a read and write file for status and job control.

              Yep. They have a read, no seek file, to scan and receive faxes; a write, no read/seek to send faxes; and a read and write file for status and job control.

              1. [2]
                zaarn
                Link Parent
                You can't receive faxes from a read-only file because it requires negotiation of the image format and metadata. Sending faxes is also quite the dance to dial the phone number and push the data...

                You can't receive faxes from a read-only file because it requires negotiation of the image format and metadata. Sending faxes is also quite the dance to dial the phone number and push the data through.

                Job Control isn't handled by a computer unless you use a print server, which doesn't handle job control on the printer but on the server itself.

                Any of those will require developing a protocol for interacting with the file, which kind of makes the entire thing have at least three times as much overhead as necessary if it just had the appropriate API.

                1 vote
                1. ubergeek
                  Link Parent
                  You do know most of those happen with a read write socket, right? And hardware handles the faxing the negotiation dance. Otherwise, from the PC side... it's just an input device.

                  You do know most of those happen with a read write socket, right?

                  And hardware handles the faxing the negotiation dance. Otherwise, from the PC side... it's just an input device.

      3. [5]
        dblohm7
        Link Parent
        The NT kernel can fork a process, the Win32 subsystem cannot.

        The NT kernel can fork a process, the Win32 subsystem cannot.

        2 votes
        1. [4]
          Elronnd
          Link Parent
          CMIIW, but I read recently that there was some functionality in ntdll that allowed you to sort-of hack together fork, but it was removed.

          CMIIW, but I read recently that there was some functionality in ntdll that allowed you to sort-of hack together fork, but it was removed.

          1. [3]
            dblohm7
            Link Parent
            It's still there, both in new incarnations and in old. The new version is used for fast snapshotting of processes: they basically suspend a process, fork it, resume the parent, and then capture a...

            It's still there, both in new incarnations and in old. The new version is used for fast snapshotting of processes: they basically suspend a process, fork it, resume the parent, and then capture a minidump from the child.

            NtCreateProcess has always been able to have fork semantics as well.

            I've actually been able to fork a Win32 process with a lot of hacking around (enough to throw up a MessageBox in the child process, at least), but since the Win32 subsystem is all closed source and undocumented, I'd never use it in production code.

            2 votes
            1. [2]
              Elronnd
              Link Parent
              Hmmm. I googled bit and came up with this. I assume you get fork-like semantics by setting something in ObjectAttributes? (I also found some information about RtlCloneUserProcess()) I wonder,...

              Hmmm. I googled bit and came up with this. I assume you get fork-like semantics by setting something in ObjectAttributes? (I also found some information about RtlCloneUserProcess())

              I wonder, though, why would you need to hack anything around to get MessageBox working? Why would it not Just Work?

              1 vote
              1. dblohm7
                Link Parent
                Yes, RtlCloneUserProcess() is the new fork-ish system call that is used by the snapshotting stuff. For NtCreateProcess, you just specify the ParentProcess handle. Provided that the handle has the...

                Yes, RtlCloneUserProcess() is the new fork-ish system call that is used by the snapshotting stuff.

                For NtCreateProcess, you just specify the ParentProcess handle. Provided that the handle has the right access, the created process inherits its address space. When you create the child process's initial thread using NtCreateThread, you can base its stack and context on your own thread's.

                As for Win32, there are a few issues:

                • Most of USER and GDI are implemented in the kernel via the win32k.sys driver. That driver does not expect a fork, so it can't automagically recognize the new process.
                • This is not as well known, but technically CSRSS.exe is a user-mode component of Win32. A forked process needs to register itself with CSRSS.
                  ** As an aside, this one of the myriad reasons why UWP should be considered to be a layer atop Win32, as opposed to a distinct subsystem; UWP depends on DCOM, MSRPC, and thus CSRSS, which are all Win32 components.
                • Finally, KERNEL32.DLL, USER32.DLL, and GDI32.DLL are not fork-aware, so they contain per-process and per-thread data that, if reused, will trigger hangs and/or crashes. This is because they were initialized from the parent process. To get a working Win32 fork, you need to write code to clear all of that internal state and essentially reinitialize them from scratch.
                2 votes
    2. ubergeek
      Link Parent
      This was done for one sector of drivers already: ndis-wrapper. This packages took windows wifi device drivers, wrapped then, and then acted as a kernel shim. If companies did the work themselves,...

      Unless they developed a kernel module that could act as a shim to enable Windows drivers (and I imagine the amount of work required to get that working to be significant), they'd be shooting themselves in the foot IMO.

      This was done for one sector of drivers already: ndis-wrapper. This packages took windows wifi device drivers, wrapped then, and then acted as a kernel shim.

      If companies did the work themselves, porting their drivers over would be rather easy. Of course, they would only do this themselves, mostly, if Windows required it.

      3 votes
  2. [3]
    Ember
    Link
    I feel like I'm reading a fake alternate-universe article. Windows 11? What!? There's no Windows 11. Microsoft has explicitly stated 10 is the endless version of windows. That's like asking Apple...

    I feel like I'm reading a fake alternate-universe article. Windows 11? What!? There's no Windows 11. Microsoft has explicitly stated 10 is the endless version of windows. That's like asking Apple for OSXI... an entire-OS refresh doesn't make sense any more. Regardless of what marketing buzzwords make you think, "rebuilt from the ground-up" is a waste of time in today's industry.

    Edit: I saw this in the Hacker News thread on this same article:

    I'll start taking these delusional ravings remotely seriously when authors try to analyze what it would be like to implement the driver stack, the graphics stack, the security model etc. on top of a different kernel, and demonstrate that it would change anything for the best. And not just throw away compatibility with twenty years of accumulated software and hardware.
    So far it's only “MS did a Linux-to-Win layer with questionable performance, it means they could totally do the opposite with negligible loss while keeping drivers for millions of device models working! And compatibility with software that hooks at every point in the Windows APIs! See, Wine does a small portion of that just fiiiine after the twenty six years of development.”

    11 votes
    1. [2]
      ubergeek
      Link Parent
      Windows has had a POSIX subsystem for quite some time. Can even handle NFS mounting. MS could take a whole, huge step forward by keeping the Explorer DE, and rewriting it under the hood into a...

      Windows has had a POSIX subsystem for quite some time. Can even handle NFS mounting.

      MS could take a whole, huge step forward by keeping the Explorer DE, and rewriting it under the hood into a POSIX kernel. MacOS even retained compatibility as well for a similar move to a POSIX kernel with the move from System 9 to OSX.

      5 votes
      1. Amarok
        Link Parent
        They had a full native GNU stack as well, called it services for unix. It was predictably hamstrung (no BASH/SSH, for example), and so Cygwin eventually outpaced it. It's been discontinued.

        They had a full native GNU stack as well, called it services for unix. It was predictably hamstrung (no BASH/SSH, for example), and so Cygwin eventually outpaced it. It's been discontinued.

        3 votes
  3. Wes
    Link
    I can't see it happening. Linux kernel has just as many warts as NT at this point. Even ignoring the software compatibility issues, they'd be throwing out a huge amount of hardware support. I'd...

    I can't see it happening. Linux kernel has just as many warts as NT at this point. Even ignoring the software compatibility issues, they'd be throwing out a huge amount of hardware support.

    I'd buy the argument that Microsoft have lost enough pride to actually consider the move. I just don't think the move makes business sense for them.

    10 votes
  4. [9]
    dabluecaboose
    Link
    At this point the only thing keeping me on Windows is gaming, and with the progress Valve has made with Proton, that might not even be holding me much longer. I wonder what the implications of a...

    At this point the only thing keeping me on Windows is gaming, and with the progress Valve has made with Proton, that might not even be holding me much longer. I wonder what the implications of a switch to the Linux kernel would mean for gaming. Would I be able to run all games on Linux and drop Microsoft with all its telemetry, incessant updates and GUI changes?

    4 votes
    1. PopeRigby
      Link Parent
      I feel exactly the same way. That would be amazing.

      At this point the only thing keeping me on Windows is gaming, and with the progress Valve has made with Proton, that might not even be holding me much longer.

      I feel exactly the same way.

      Would I be able to run all games on Linux and drop Microsoft with all its telemetry, incessant updates and GUI changes?

      That would be amazing.

      4 votes
    2. babypuncher
      Link Parent
      I'm torn. Gaming was the thing keeping me on Windows, but lately Microsoft has been doing a good job of making me not feel like I need to be in a full blown Linux environment. The Windows 10...

      I'm torn. Gaming was the thing keeping me on Windows, but lately Microsoft has been doing a good job of making me not feel like I need to be in a full blown Linux environment. The Windows 10 desktop is adequate. the new Windows Terminal is pretty slick, though I've gotten by fine with cmder for years. Windows Subsystem for Linux is awesome and about to get a whole lot better with WSL2. Hyper-V makes spinning up and managing Linux and Windows VMs pretty trivial. Most of my issues with Windows are just kind of evaporating.

      2 votes
    3. [6]
      cwagner
      Link Parent
      Besides some work stuff (I still need Visual Studio to publish some older projects, mostly switched to JetBrains though; also full .NET Framework projects; both could be fixed by dual booting),...

      At this point the only thing keeping me on Windows is gaming

      Besides some work stuff (I still need Visual Studio to publish some older projects, mostly switched to JetBrains though; also full .NET Framework projects; both could be fixed by dual booting), I’m not sure I could give up the best Music Organizer (MediaMonkey) and file explorer (Directory Opus) I know of. Gaming is comparatively far less of a problem, I could dual boot or use a VM there.

      1 vote
      1. Amarok
        Link Parent
        Mediamonkey has to work on wine. The only apps that crap out on wine are either trying to talk to the hardware directly or are buried in the mess that is .net development and tied into that morass...

        Mediamonkey has to work on wine. The only apps that crap out on wine are either trying to talk to the hardware directly or are buried in the mess that is .net development and tied into that morass of windows registry hell. Most apps outside of Microsoft's flagship suites and modern games don't do either one of those things.

        1 vote
      2. [4]
        ubergeek
        Link Parent
        FWIW, Directory Opus looks like the KDE file manager, mostly.

        FWIW, Directory Opus looks like the KDE file manager, mostly.

        1. [3]
          cwagner
          Link Parent
          Basic example: 4 panes, 2 are file trees synchronized with the directory panel, 2 showing directory content, multi tabbed with per-tab settings (for example grouping, syncing with the other pane...

          Basic example: 4 panes, 2 are file trees synchronized with the directory panel, 2 showing directory content, multi tabbed with per-tab settings (for example grouping, syncing with the other pane or [soft]locking the directory). That’s just the main features I use that are not usually in other file managers.

  5. mrbig
    (edited )
    Link
    Is Microsoft going to keep the numbered version releases? I remember reading they'd be switching to a subscription model eventually.

    Is Microsoft going to keep the numbered version releases? I remember reading they'd be switching to a subscription model eventually.

    2 votes
  6. [2]
    Bauke
    Link
    Non-AMP link.
    7 votes
    1. PopeRigby
      Link Parent
      Whoops. I don't even use Google. Don't know how that got in there. Can you edit the link, @Deimos?

      Whoops. I don't even use Google. Don't know how that got in there. Can you edit the link, @Deimos?

      4 votes