1

Disclaimers: First off, I'm not 100% sure if I'm in the right StackExchange community for this question, but I couldn't find one for generic operating system questions. Please let me know if I should move this elsewhere.

Secondly, please excuse my ignorance if this is a stupid question - my knowledge on the inner workings of operating systems at this point is limited to what I've learned over the years randomly and an undergrad "operating systems" course that taught basic concepts like memory management and CPU control using XINU.

Question: What is the issue (or some of the issues) that prevent us from developing a single kernel that supports both Linux Kernel and Windows NT system calls? At an extremely basic level, I would expect that it would be possible (if time-consuming) for me to create a modified version of the linux kernel that also supports Windows-style system calls.

If I were to make the aforementioned frankenstein kernel (and tell it how to interpret microsoft's '.exe' executable format), would I then be able to run both windows-based and unix-based executables?

I'm not super knowledgeable on WINE, but I imagine it does something like this, acting as a sort of compatibility layer that converts the windows calls into their linux equivalents. So what's stopping us from adding this sort of functionality into the kernel itself (thus skipping the overhead)?

Is it a copyright issue with Microsoft? Is it just that the two operating systems are so vastly different under the hood that this cant be done at all?

I've searched for information about this (or at least explanations of why it can't/hasn't been done) but didn't find much. I did come across a project called Longene where it looks like a group in China was attempting to do exactly this, but it seems to have died as quickly as it started.

My thinking is that maybe something like this would just be too large of an undertaking/too much maintenance to be worth it. However, I'd like to get some input from people who have a deeper understanding of operating systems, and this seems like the right place for that (considering there can't be a community for Windows kernel developers, as it's all proprietary).

2
  • Consider what it would take to for example load Call of Duty as a Word document and run it. This is why it's difficult.
    – CR.
    May 25, 2022 at 22:09
  • 1
    You've answered this question yourself. This is exactly what WINE is for. It doesn't need to be in the Linux kernel, and nobody wants it in the kernel (but there's no problem with kernel code to better support WINE if/when that proves to be necessary and doesn't break anything else). Lots of Windows programs work well with WINE, but many don't. Some make no sense to run on Linux (e.g. Windows' chkdsk, and fdisk and many other utils), some have native linux ports/versions (e.g. quite a few games), and some have roughly equivalent or even superior Linux native alternatives (e.g. Libre Office)
    – cas
    May 26, 2022 at 10:07

2 Answers 2

3

In one sense it has been or is being attempted. The REACT OS is an attempt to clone the Win 95 OS and the problems they have encountered are representative of any attempt that might be made to clone NT.

  1. Microsoft purposely develops updates and changes faster than programmers can reveres engineer clones. Microsoft has always started development of their next generation OS before the current one is released and keeps the features and code proprietary. Before Win 7 was released, they had already started Win 10, and Win 11 was started before the release of Win 10. (And yes they lied that Win 10 was the last OS!) They are working on their next two generations as we speak.

  2. Microsoft products are not generally appealing enough to a large enough audience to take the time to clone. Rather most people want something "better" or different.

  3. The REACT OS mentioned above is still fairly unstable after 20+ years of development. Additionally, hardware changes at such a rapid state that even if they had a stable version 5-10 years ago, new hardware requirements would probably over tax the groups accomplishments.

Imagine the effort that would be needed just to maintain compatibility with all the new sound and video cards and chips! It would be a never ending thankless job :(

1

What is the issue (or some of the issues) that prevent us from developing a single kernel that supports both Linux Kernel and Windows NT system calls?

  1. Developerhours available.
  2. there's a few ways in which Windows and Linux are different; If you guarantee "concurrent write access to files always comes in ordered at all readers" for one API and for the other you guarantee "no write access might ever be blocked by another write", then you got a logical conflict (I don't know whether this example applies to the two OSes, btw.). You can abstract one away from the other, but often, you lose some capabilities on the way.

At an extremely basic level, I would expect that it would be possible (if time-consuming) for me to create a modified version of the linux kernel that also supports Windows-style system calls.

WindowsNT has a POSIX API, i.e. a UNIX-style API (since NT4!), and Linux (pretty much) also does. So, in a way, that operating system exists, and it's Windows.

I'm not super knowledgeable on WINE, but I imagine it does something like this, acting as a sort of compatibility layer that converts the windows calls into their linux equivalents.

Yep! Translates a few syscalls, offers (parts of) the userland libraries that come with windows, among other things.

Is it a copyright issue with Microsoft?

Probably not. Oracle vs Google on the Java API has court-proven that you can't copyright an API (in the US). I'm not a lawyer, though, and it's hard to see how well this would extend to the Windows API. But WINE's not gotten into trouble, so it's probably hard to start enforcing this now.

If I were to make the aforementioned frankenstein kernel (and tell it how to interpret microsoft's '.exe' executable format), would I then be able to run both windows-based and unix-based executables?

Ignoring the word "kernel" in there: together with WINE and the Linux kernel's binfmt_misc, you can do this (for quite some Windows software) today. It's quite commonly done!

1
  • 1
    The POSIX subsystem for Windows was removed sometime in the early 2000s.
    – fpmurphy
    May 25, 2022 at 23:16

Not the answer you're looking for? Browse other questions tagged .