How the latest gaming AI beat world champions of poker Watch Now

Linux has never been a hot gaming platform. Valve, creator of the Steam game engine and network, has long wanted Linux to replace Windows as the PC gaming platform. Indeed, Gabe Newell, Valve's CEO, once said, "Linux is the future of gaming." That didn't happen, but Valve didn't give up on Linux. Now, Valve is doubling down on Linux, by proposing changes to the Linux kernel to make it more gaming-friendly.

To give you some background, Newell turned sour on Windows, with the release of Windows 8, declaring, "Windows 8 is a catastrophe for everyone in the PC space." By the next year, Newell said, "Linux is the future of gaming for gamers on the client as well, because, besides Microsoft moving to a more locked-in style of computing . . . Closed systems are at odds with the evolution of gaming."

So, Valve, under his leadership, started building "Steam Machines." These were Linux gaming PCs and consoles. But these never took off. They were slow to get to the market. And, as Frank Azor, co-founder of Alienware, Dell's gaming division and an early Steam Machine supporter, said, "Microsoft learned a very valuable lesson -- a lot of valuable lessons -- with Windows 8 and tried to correct those with Windows 10. It's more gamer-focused."

While Steam machines ran out of steam, Valve changed its Linux gaming course. Instead of porting games to Linux, they use Wine to enable players to run Windows games on Linux. Wine is an open-source project that implements the Windows application programming interface (API) on top of the Unix and Linux operating system family. It works by translating Windows API calls into POSIX calls on-the-fly. With Wine, you can run many Windows applications on Linux or macOS.

But games, which demand a lot from hardware, are challenging to run on Wine. Valve addressed this by releasing a beta version of Steam Play that includes a gamer-friendly version of Wine: Proton. It's also deployed DXVK. This translates Windows Direct3D 10/11 calls into POSIX calls. All this comes together to enable you to run 3D applications, not just games, on Linux with Proton.

While this helped a lot, there were still performance problems. So, in the release notes for the latest edition of Proton, Valve announced it was proposing changes to the Linux kernel itself to make Linux more game-friendly.

This includes an experimental replacement for esync, which improves performance with multithreaded games or any application that pushes the CPU. But esync came with potential problems. Because it relies on the kernel's eventfd() functionality, esync needs special setup and can cause file descriptor exhaustion problems in event-hungry applications.

So, Valve is proposing changes to the Linux kernel. This will extend the futex() (fast user-space locking) system call to expose the extra bit of core functionality needed to support optimal thread pool synchronization. Proton 4.11 includes the fsync patchset, which will leverage this new Linux kernel functionality to replace esync when supported.

In the patch request, Gabriel Krisman Bertazi, Collabora software engineer and kernel developer, added, "We are also proposing modifications to glibc and libpthread to make this feature available for Linux native multithreaded applications using libpthread, which can benefit from the behavior of waiting on any of a group of futexes."

How much of a boost would you get? According to Bertazi, using "futexes in our Wine use case reduced the CPU utilization by 4% for the game Beat Saber and by 1.5% for the game Shadow of Tomb Raider, both running over Proton (a wine-based solution for Windows emulation), when compared to the eventfd interface."

So far, the Linux kernel community seems to welcome this proposal. The only comments so far have been to clean up the proposed patch.

Valve is posting proof-of-concept glibc patches for upstream review and discussion. These expose the corresponding kernel functionality as part of the pthread library. Valve believes, that if this feature (or an equivalent) were adopted upstream, "we would achieve efficiency gains by adopting it in native massively-threaded applications such as Steam and the Source 2 engine."

Want to see if the beta works for you? Valve has made packages available for Arch and Ubuntu Linux. The last also indicates that Valve and Ubuntu seem to have got over their recent spat about 32-bit libraries.

Happy gaming!

Related Stories: