Back in 2021, a contributor to the Wine project started out to build something that would allow for the implementation of the Windows NT synchronization object API into the Linux kernel.
Doing that improved performance for Windows apps on Linux when using Wine or Valve's Proton that is based on the former. But, progress on that kind of slowed down along the years.
Enter 2024, where that has gotten a major boost by the same person who kick-started it all.
Elizabeth Figura who now works for CodeWeavers, posted a patch with “request for comments” (RFC) label in the Linux kernel mailing lists around the end of January. And, this was to introduce a new driver for implementing Windows NT synchronization primitive (NTSYNC) directly into the Linux kernel.
She also shared some helpful benchmarks that show games running better with average improvement rates ranging from 50% to 150% when using the new driver compared to not using it.
So, let's dive in see and what's in store! 😃
Windows NTSYNC Primitive: What to Expect?
The need for such a driver arose when it was found that the NT synchronization primitives, a key part of the Windows API emulated by Wine performed horribly on heavy multithreaded tasks when an RPC was made to wineserver.
This resulted in a bottleneck that caused many apps and games to not run to their full potential, causing a wide variety of slowdowns, bugs and what not.
On an older kernel mailing list post, Elizabeth mentioned that:
In recent years applications, especially high-performance games, have made heavy use of multiple threads, and consequently heavy use of these synchronization primitives.
The RPC to the wineserver has become not just a bottleneck, but a heavy bottleneck. It's particularly a problem because the server is single-threaded and can only service one request at a time.
The issue of the NT synchronization APIs was it being tricky to implement on top of the existing primitives “without sacrificing correctness”. So, a solution to resolve the issue was the need of the hour.
She also clarified the technical bits for developers:
Operations like NtPulseEvent() or the “wait-for-all” mode of NtWaitForMultipleObjects() would require better control to work properly, and that is not possible without a solution.
That is where the Windows NTSYNC primitive driver aims to deliver by acting as a new character device for implementing “problematic interfaces” directly into the Linux kernel.
I promise I won't go more into the tech bits meant for developers 😅
So, here are some benchmarking numbers that ought to make it simpler for you. These tests were done on various hardware running games, both old and new, with and without the new driver being active.
The results look quite promising if you ask me:
If these numbers are any indication, then Windows-only apps and games should run better than ever before when using Wine or other Wine-based derivatives.
I can't wait to see when this is implemented into the Linux kernel. But, after reading all that, you're maybe wondering; when will this become a reality?
Well, it will take some time as this is still subject to approval from the maintainers and Linus Torvalds himself; if he chooses to look at it more closely.
For now, you can only wait and see whether this change is approved in time for any of the upcoming Linux kernel releases.
For staying up to date with the status and to learn more about the Windows NTSYNC primitive driver, you can refer to the mailing list.
💬 What do you think of the new driver? Share your thoughts!
Here's why you should opt for It's FOSS Plus Membership
- Even the biggest players in the Linux world don't care about desktop Linux users. We do.
- We don't put content behind paywall. Your support keeps it open for everyone. Think of it like 'pay it forward'.
- Don't like ads? With the Plus membership, you get an ad-free reading experience.
- When millions of AI-generated content is being published daily, you read and learn from real human Linux users.
- It costs just $2 a month, less than the cost of your favorite burger.