Penguin in the window: about the potential and prospects of WSL2

Hey Habr!

While we are in full swing summer Sale, we would like to invite you to discuss one of the most ambitious topics that we have been working on lately - the interaction between Windows and Linux, associated, in particular, with the development of the system WSL. WSL 2 is on its way, and here's a quick look at the features that await us in this subsystem, as well as a forecast of further integration of Windows and Linux.

Penguin in the window: about the potential and prospects of WSL2

In May of this year, Microsoft announced that WSL2, the latest version of the Windows Subsystem on Linux, would run on a full-fledged Linux kernel built by the company.
Thus, for the first time, Microsoft includes the Linux kernel as a component in Windows. Microsoft is also introducing a command line to Windows that will extend the power of PowerShell and WSL.

Both the Linux kernel for WSL2, created by Microsoft, and the new Windows command line are of interest primarily to developers.

"This is the most powerful move in the game against AWS," said Joshua Schwartz, head of digitalization programs at consulting firm AT Kearney.

The future of Microsoft is not connected with the PC market, although it will continue to firmly hold its position in this segment. It will be much more important to gain a foothold in the cloud market, one of the components of which in the future may become desktop PCs.

What WSL2 does

WSL2 is the latest Windows Subsystem Framework for Linux. It allows you to radically improve the performance of the file system and provides full compatibility with system calls.

One of the main requests of the WSL community was related to the finalization of the functionality. WSL2 runs many more Linux tools than WSL, notably Docker and FUSE.
WSL2 handles intensive file operations such as git clone, npm install, apt update and apt upgrade. The actual speed increase depends on the specific application and how it interacts with the file system.

The first tests showed that WSL2 is about 20 times faster than WSL1 at decompressing tar from zip. When using git clone, npm install and cmake in various projects, the system showed a performance increase of two to five times.

Will it help win the trust of developers?

In essence, Microsoft is seeking to gain acceptance and trust in the developer community by taking on the development of its own version of the Linux kernel to support WSL2 processes, said Cody Swann, CEO at Gunner Technology.

β€œApart from strictly Windows development, building all other applicationsβ€”cloud, mobile, webβ€”on a PC was extremely inconvenient, causing the developer to somehow have to boot a Linux distribution side-by-side with Windows. Microsoft recognized this and came up with a solution,” he concludes.

It is unlikely that the introduction of a native Linux kernel will seriously affect the operation of the system from the point of view of the average user. However, this opens up opportunities for closer interaction between Microsoft services and the Linux operating system.
Such a move on the part of Microsoft is really very competent, as it helps to penetrate deeper into the developer community, as well as actively use products that someone else is developing - that is, connect to open source, Swann believes.

Welcome to New Microsoft

The trend towards building and maintaining a Linux kernel "tailor-made for Windows" reflects the strong open-source direction being promoted by CEO Satya Nadella. Microsoft is no longer the same as under Gates and Ballmer, when everything was kept behind a proprietary fence, and no one thought about interoperability.

β€œSatya completely transformed Microsoft into a much more modern platform, and this strategy has paid off handsomely. Hello, trillion dollar capitalization,” says Schwartz.

According to Charles King, chief analyst at Pund-IT, Microsoft's two main strengths are efficiency and security.

β€œBy actively leveraging its own solid know-howβ€”resources and toolsβ€”the company can ensure customers that the kernel is fully up-to-date and equipped with the latest patches and fixes to ensure complete security,” he adds.

Developers also benefit

Linux binaries perform many functions using system calls, such as accessing files, requesting memory, and creating processes. WSL1 relies on a translation layer to interpret many of these system calls and allow them to interact with the Windows NT kernel.

The most difficult thing is to implement all the system calls. Since this was not done in WSL1, some applications could not work there. WSL2 introduces many new applications that work well in this environment.

The new architecture allows Microsoft to bring the latest optimizations to the Linux kernel much faster than with WSL1. Microsoft may update the WSL2 core rather than re-implement all restrictions.

Fully open source tool

Microsoft's development of its own Linux kernel was the culmination of years of work by the Linux Systems Group, as well as many other teams operating throughout Microsoft, testifies Jack Hammons, Program Manager at Linux Systems Group, Microsoft.

The kernel provided for WSL2 will be fully open source, and Microsoft will post instructions on GitHub on how to build such a kernel. The company will engage with developers willing to help the project and drive upward change.

Microsoft developers built WSL2 using the company's continuous integration and continuous delivery systems. This software will be maintained through the Windows update system and will be completely transparent to the user. The kernel will remain up-to-date and include all the features of the latest stable branch of Linux.

To ensure source availability, the company mirrors repositories locally, constantly monitors the Linux mailing list for security issues, and works with several companies to support CVE databases. This ensures that Microsoft's Linux kernel keeps up to date with the latest updates and fixes any emerging threats.

Upward changes become mandatory

Microsoft ensures that all kernel changes are upstream, an important aspect of the Linux philosophy. Downstream patch support comes with additional complexity; moreover, this practice is not generally accepted in the free development community.

The goal of Microsoft, actively using Linux, is to become a disciplined member of this community and to deliver the changes it makes to the community. In order to maintain the stability of the branches associated with long-term support, some patches - for example, those containing new features - can only be included in new versions of the kernel, and not ported to the current LTS version in backward compatibility mode.

When the WSL core sources become available, they will consist of links to the patch set and a long-running stable part of the sources. Microsoft expects this list to shrink over time as patches roll out upstream, with new local patches added to support the latest WSL features.

Better looking windows

Microsoft also announced the release of the upcoming "winter" version of Windows Terminal - a new application for users working with command line tools and shells, in particular, Command Prompt, PowerShell and WSL.

Penguin in the window: about the potential and prospects of WSL2

Windows Terminal

Windows Terminal 1.0 offers many tweaks and configuration options that give you more control over the appearance of the terminal window, as well as which skins/profiles should open as new tabs.

The settings will be saved in a structured text file, making it easy to configure them and design the terminal window to your liking.

Microsoft stops refining the existing Windows console, and creates a new one from scratch, deciding to apply a fresh approach. Windows Terminal installs and runs in parallel with the existing Windows Console application that comes out of the box.

How it works

When a Windows 10 user directly launches Cmd/PowerShell/etc, the process attached to the regular Console instance fires. The new terminal configuration mechanism allows Windows users to create multiple profiles for all the shells/applications/tools they want, whether in PowerShell, command line, Ubuntu, or even SSH connections to Azure or IoT devices.

These profiles can have their own combinations of design and font size, color themes, blur levels, or background transparency. In addition, users will be able to select a new monospaced font to make the terminal window look more modern and cool. This font provides programmer ligatures, it will be made available to the public and will be stored in its own repository.

The main advantages of the new Windows command interface are many tabs and beautiful text. Support for multiple tabs was considered the most requested request for terminal development. Beautiful text comes from a GPU-accelerated DirectWrite/DirectX rendering engine.

The engine renders text icons, glyphs, and special characters found in fonts, including Chinese, Japanese, and Korean ideograms (CJK), emoji, powerline characters, icons, and programming ligatures. In addition, this engine renders text much faster than the GDI previously used in the console.

Backward compatibility remains in order, although you can try Windows Terminal if you wish.

Chronology: how it will be

Microsoft will provide Windows Terminal through the Microsoft Store in Windows 10 and update it regularly. Thus, users will always work with the latest versions and the latest improvements - with little or no extra effort.

Microsoft plans to launch a new terminal next winter. After Microsoft rolls out Windows Terminal 1.0, developers will continue to work on many of the features already shelved in the backlog.

Windows Terminal and Windows Console Source Code already posted on GitHub.

What can we expect in the future?

The possibility that Microsoft will use its own Linux kernel for other purposes, such as developing its own Linux distribution, seems somewhat hypothetical today.

Perhaps the outcome depends on whether Microsoft manages to find a noticeable demand for such a product, and what commercial opportunities such developments can potentially open up, says Charles King.

He thinks that for the foreseeable future, the company will focus on making Windows and Linux increasingly compatible and complementary.

Joshua Schwartz believes that in this case it will be necessary to weigh what will be the investment in this work, and what is the return on it. If Microsoft were a very young company today, it would probably do everything based on Linux. However, porting all the developments that Microsoft already has to the native Linux architecture today seems to be an expensive and complex project that is unlikely to pay off well. Linux lovers will get their own Linux, and the core architecture will remain intact.

When Apple reinvented Mac OS in 2000, the operating system was based on BSD Unix, which is more like Linux than DOS. Today, a new version of Microsoft Windows is being created on the basis of Linux.

Perhaps a new door is opening before us?

Microsoft's Linux kernel may open the way for closer interaction between Windows services and the Linux operating system. In essence, these Microsoft developments indicate that Microsoft itself already understands that today there are almost no customers left who prefer to exist in a world where solid Windows is everywhere.

It is much wiser to use heterogeneous technologies and systems that best meet business requirements and specific practical situations.

The more important strategic question is, what new strategic opportunities does such a move open up for the Microsoft platform itself?

Azure, Microsoft's cloud ecosystem, already provides tremendous support for Linux. Previously, Windows supported Linux well with virtual machines.

The fundamental changes taking place today are related to the fact that now Linux processes will run natively on the Windows kernel, which means that working with Linux from Windows will go much faster than on virtual machines. It is likely that as a result, Azure will be enriched by a whole layer of engineers using Linux on an industrial scale.

Source: habr.com

Add a comment