64

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 Answers2

67

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 10 Build 19044+ or Windows 11) 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.

BE-Code
  • 3
  • 2
Bob
  • 63,170
6

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.

NotTheDr01ds
  • 28,025