← Back to context

Comment by teruakohatu

6 months ago

> How hard is it to emulate linux system calls?

It’s doable but a lot more effort. Microsoft did it with WSL1 and abandoned it with WSL2.

Note that they didn't "do it" for WSL1, they started doing it, realized it is far too much work to cover eveything, and abandoned the approach in favor of VMs. It's not like WSL1 was a fully functioning Linux emulator on top of Windows, it was still very far from it, even though it could do many common tasks.

  • I've always wondered why only Linux can do 'true' containers without VMs. Is there a good blog post or something I can read about the various technical hurdles?

    • Many OS's have their own (sometimes multiple) container technologies, but the ecosystem and zeitgeist revolves around OCI Linux containers.

      So it's more cultural than technical. I believe you can run OCI Windows containers on Windows with no VM, although I haven't tried this myself.

    • BSD can do BSD containers with Jails for more than a decade now?

      Due to innate features of a container, it can be of the same OS of the host running on the system, since they have no kernel. Otherwise you need to go the VM route.

      2 replies →

    • I'm not sure about MacOS, but otherwise all major OSs today can run containers natively. However, the interest in non-Linux containers is generally very very low. You can absolutely run Kubernetes as native Windows binaries [0] in native Windows containers, but why would you?

      Note that containers, by definition, rely on the host OS kernel. So a Windows container can only run Windows binaries that interact with Windows syscalls. You can't run Linux binaries in a Windows container anymore than you can run them on Windows directly. You can run Word in a Windows container, but not GCC.

      [0] https://learn.microsoft.com/en-us/virtualization/windowscont...

      3 replies →

    • Containers are essentially just a wrapper tool for a linux kernel feature called cgroups, with some added things such as layered fs and the distribution method.

      You can also use just use cgroups with systemd.

      Now, you could implement something fairly similar in each OS, but you wouldn't be able to use the vast majority of contained software, because it's ultimately linux software.

      2 replies →

    • Every OS can theoretically do 'true' containers without VMs - for containers which match the host platform.

      You can have Windows containers running on Windows, for instance.

      Containers themselves are a packaging format, and do rather little to solve the problem of e.g. running Linux-compiled executables on macOS.