Skip to content
hninhninhtun edited this page Sep 15, 2022 · 9 revisions

This article describes similarities and differences between Foreign Linux and other similar projects.

Introduction

Foreign LINUX serves as a low level emulator (LLE) unlike WINE or cygwin which is an HLE (high level emulator). We only implement kernel system calls and use the original unmodified system libraries to provide common ABIs. This greatly reduces the amount of work and improves emulation accuracy.

Foreign LINUX dynamically translates Linux system calls to their Windows equivalents, or emulates them if not directly available natively (notably fork). This is like WINE. But due to some incompatibilities between the two systems and the limitations of Windows, the binary cannot be directly run like in WINE. Instead I implemented a dynamic binary translator to process the binaries and transform the incompatible bits before it is run.

Cygwin is highly related with Foreign Linux as they share one same goal - make it easier to run common Linux applications on a pure Windows environment. But to achieve the goal they use very different strategies. Cygwin is actually a set of API lying on top of Windows API to provide POSIX-like functionality. Applications want to run under Cygwin must be recompiled from source using the Cygwin toolchain, while Foreign Linux lets the user run native Linux applications directly.

Cooperative Linux is a patchset for the Linux kernel. It allows the kernel to run in VMX mode alongside Windows. Thus it is more like a lightweight virtual machine but with minimal overhead. The biggest issue of coLinux is the need to use a kernel mode driver. It works fine for x86. But the driver hasn't been ported to x64 for many years.

Other Linux-binary-on-Windows projects

There are of course other similar projects doing the same thing. But as far as I know their development are all stale.

  • atratus: atratus uses a server-client architecture. The "kernel" process manages all "client" data and acts as a debugger of the client processes. The benefit of this approach is that clients can get a very clean memory layout which is useful for fork(), and the file sharing semantics can be easy to implement. But the downsides are the need to do process scheduling manually, and true multithreading will hardly work as one debug event will pause the whole process.

  • LBW: Linux Binaries on Windows uses Interix to implement many POSIX functions, notably fork(). As Interix is now deprecated, LBW is no longer useful.

  • LINE: LINE Is Not an Emulator is a very early project to run linux binaries on Windows. It sill work on Win8 x64 as I tested. It uses Cygwin for POSIX layer thus no efficient fork().