How the heck did they do that? First, Ubuntu parent company Canonical and Microsoft will be running it not on Linux in a container or virtual machine (VM), but on Windows native libraries and programs: Windows Subsystem for Linux (WSL).
WSL was quietly placed in the Windows 10 (build 14251) code in late January. A few days later, a developer worked out that two new subsystems lxcore.sys and lxss.sys, could be bridges for Windows programmers to develop Linux applications. The developer was half right.
WSL can be used for that, but its first job is to support an Ubuntu user-mode image. A Microsoft spokesperson explained, "We built new infrastructure within Windows, WSL, upon which we run a genuine Ubuntu user-mode image provided by our great partners over at Canonical, creators of Ubuntu Linux. The result is that you can now run native Bash on Ubuntu on Windows."
This is not a Cygwin variation, noted Dustin Kirkland, a member of Canonical's Ubuntu Product and Strategy executive team. Cygwin's "open source utilities are recompiled from source to run natively in Windows," said Kirkland. "Here, we're talking about bit-for-bit, checksum-for-checksum Ubuntu ELF binaries running directly in Windows."
Kirkland continued, "A team of sharp developers at Microsoft has been hard at work adapting some Microsoft research technology to basically perform real time translation of Linux syscalls into Windows OS syscalls. Linux geeks can think of it sort of the inverse of "WINE" -- Ubuntu binaries running natively in Windows. Microsoft calls it a "Windows Subsystem for Linux". (No, it's not open source at this time.)"
Some people are already saying: "Oh I bet that runs like a 100-meter sprinter on a track of mud." Wrong. Kirkland claims "it's totally hot. The sysbench utility is showing nearly equivalent cpu, memory, and I/O performance."
WSL isn't ready for prime time yet. A Canonical representative said it's "early days yet -- this is a beta release."
Kirkland added: "The vast majority of the LTP passes and works well. But there are some imperfections still, especially around tty's and the vt100. My beloved byobu, screen, and tmux don't quite work yet, but they're getting close."
This is not a new idea. In fact, it's a downright ancient notion. It goes all the way back to the Windows NT POSIX subsystem. NT Posix was designed to run native Unix -- Linux hadn't been created yet -- binaries on Windows NT.
Many people have been asking me "Why!?" Kirkland's answered in an interview, echoing Steve Ballmer, "Developers, developers, developers. Microsoft recognizes that while developers today might run Windows or Mac (or maybe Ubuntu) on their desktop, inevitably those end up spending much of their time in a Linux shell. Before this new feature of Windows 10, Windows users would need to run a VM (resource hungry), ssh to a cloud instance (requires connectivity), or fiddle around with Cygwin (hacky, slow). With this new feature, a Windows user simple presses the Windows start key, and types "bash" or "ubuntu", and they end up in a rich, Ubuntu shell, with access to all of Ubuntu and most of the entire world of apt, running natively, without virtualization or recompilation."
In his blog post, Kirkland continued, "This is an almost surreal endorsement by Microsoft on the importance of open source to developers. [It's] a fantastic opportunity to bridge the world of free and open source technology directly into any Windows 10 desktop on the planet. And what a wonderful vector into learning and using more Ubuntu and Linux in public clouds."
Speaking of the cloud, in the interview, Kirkland, added, "It's well known that Ubuntu is the most popular Linux distro in Azure and other clouds. A native Ubuntu shell built directly into the Windows desktop just makes it that much easier to write code using Visual Studio, vim, or emacs, and then push it to a cloud instance with git, scp, or rsync, and vice versa. Obviously, many of those cloud instances will be Azure Ubuntu instances."
Canonical's founder, Mark Shuttleworth, is excited by this new technology partnership. Shuttleworth said, "The native availability of a full Ubuntu environment on Windows, without virtualization or emulation, is a milestone that defies convention. We are delighted to stand behind Ubuntu for Windows, committed to addressing the needs of Windows developers exploring Linux in this amazing new way."
Interesting in giving it a try? The first Ubuntu image for Windows 10, Ubuntu 14.04 LTS, will be available soon. Ubuntu 16.04 LTS, which will be replacing Ubuntu 14.04, will be available on the Windows Store shortly after it's released on April 21.. Since the image relies on code in Redstone, you'll need to be running Windows Build 14251 or later. Microsoft just announced that it will be releasing Windows 10 Redstone 1, aka "Windows 10 Anniversary Update" or Windows 10 SP1 to me, this summer.