53

Did anybody still remember coLinux? I remember it is used for SpeedLinux and Portable Ubuntu some years ago.

It's pretty clear what is coLinux doing, running Linux on top of Windows somehow, but can use real linux partition. Meanwhile cygwin is recompiling linux apps to use on Windows.

But WSL? is WSL closer to coLinux or Cygwin?

EDIT 2020/06/16 to add more confusion, there's now WSL2. But from what I understand so far, it is just a virtual machine.

2 Answers 2

56

WSL would be closer to coLinux than Cygwin.


Keep in mind that Unix, POSIX and Linux are different things.

Cygwin is a POSIX compatibility layer that runs on top of the Win32 subsystem. It has approximately nothing to do with Linux; it can broadly be treated as "just another Unix-like" where porting programs requires recompilation and possibly source modification, and anything that requires non-POSIX Linux-specific features probably won't work.

WSL 1 is designed to be ABI-compatible with Linux proper. It does not use the real Linux kernel, but is compatible such that programs compiled for Linux can run on it without recompilation or translation. WSL is part of the NT kernel, so exists independently of the Win32 subsystem. This is similar to the older SUA, though that was a POSIX (not Linux!) subsystem on top of the NT kernel.

WSL 2, runs a real Linux kernel on a lightweight VM. It promises similar Windows integration as WSL 1 but with a real Linux kernel (so kernel modules, filesystems, etc., should work). It also has proper GUI support (on Windows 11 only) but has reduced I/O performance when accessing Windows filesystems compared to WSL 1.

coLinux runs a real (though modified) Linux kernel. On the Windows side, it exists as a driver that provides memory management and I/O access. Conceptually, it is closest to a virtual machine, though with closer integration between host and "guest". coLinux has not had a release since 2011 and I see no activity on their SourceForge page; it can probably be considered a dead project.


From a program's perspective, both WSL and coLinux look approximately the same as a real Linux kernel running on raw hardware. WSL (currently) has more limitations and quirks, but also has first-party (Microsoft) support and works on x86_64. coLinux and WSL 2 are real Linux kernels, so will behave just like Linux, whereas WSL 1 is a clean-room implementation of the ABI.

Cygwin does not look any closer to Linux than, say, FreeBSD does from the program's perspective.

11
  • 2
    I do agree that colinux is for now, much better. Its sad that nobody ported it to x86-64. Sep 24, 2018 at 1:55
  • 3
    @RinaldoJonathan Personally, I prefer the WSL approach. IMO the coLinux approach is relatively fragile (poorly defined interfaces between the two kernels). In fact, I'd take a full VM over coLinux. But it does depend on what you need.
    – Bob
    Sep 24, 2018 at 2:01
  • 14
    At the command-line prompt, Cygwin looks closer to Linux than FreeBSD does to Linux, because it provides the GNU user-space commands that are typically available on Linux systems, rather than the FreeBSD commands. Apr 9, 2019 at 13:51
  • 1
    @RinaldoJonathan The emphasis there is on the integration with Windows. Filesystem access, RAM scaling, socket sharing, etc.. You could probably mimic much of it with a lot of manual work with a full-fat VM but it won't ever be as complete. From a user's perspective, usage of WSL2 should feel much like usage of WSL1; you never really notice the hypervisor at all.
    – Bob
    Jun 16, 2020 at 8:50
  • 1
    @eigenfield You are free to use whichever you wish, based on your own critera. I do need to point out that your 'test' is not representative of any other usage. cp by itself is a very simple command and almost purely bottlenecked by I/O. Your earlier example command, find -exec grep, performs many fork+exec and is more likely to be bottlenecked by cygwin translation. The difference is even more apparent if you start running build scripts or compilation workloads. You are also unclear whether you tested against WSL1 or WSL2; the latter has caveats I already mentioned.
    – Bob
    Feb 8 at 2:51
3

Great answer by Bob, but I'll just add one clarifying detail on WSL2.

... there's now WSL2. But from what I understand so far, it is just a virtual machine.

WSL2 is more like Docker (and other containerization technologies) than a VM itself. Yes, the WSL2 subsystem (the portion called the "Virtual Machine Platform") is running in a lightweight virtual machine, but we don't have access to the actual VM itself. Instead, that VM is used to run "distributions" (I tend to call them "instances") in their own namespaces.

Each WSL2 instance has a separate:

  • PID namespace
  • Mount namespace
  • IPC namespace
  • UTS namespace
  • WSLg System Distribution (Windows 11 only)

However, they all share the following with the parent WSL2 VM (and thus each other):

  • User namespace
  • Network namespace
  • Cgroup namespace
  • Device tree (other than /dev/pts)
  • CPU/Kernel/Memory/Swap (obviously)
  • /init binary (but not process)

More reading: There's a great chapter in the book Containerization with LXC that explains a lot of the concepts involved here in detail. It's currently a free sample chapter at Packt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.