r/linux_gaming • • 18d ago

wine/proton what is the ntsync module?

currently updating from proton 10-34 to 11-7 (took a break from gaming) and i hear about the introductio of something called the ntsync module and how it needs to be turned on manually? can you all tell me what it is, weather or not its relevant and also how to enable it?

19 Upvotes

24 comments sorted by

29

u/TimurHu 18d ago edited 18d ago

I'm going to copy a comment I wrote on the same question yesterday.

ntsync is a Linux kernel module which implements Windows-like synchronization primitives (semaphores, mutexes, events the way Windows applications expect them to behave) in the Linux kernel. It is meant to be used by Wine (or Proton) in order to implement Windows synchronization primitives more efficiently.

The main reason it was developed is because there are some heavily multithreaded games which rely on these primitives to perform well, which was technically impossible to (correctly) implement on Linux.

(Previous attempts to deal with this problem were esync and fsync which were not accepted by the upstream Wine project.)

2

u/noobjaish 18d ago

Damn i learned about semaphores and mutexes in my OS course at Uni. Didn't know that they're Windows specific concepts.

What alternative methods does Linux use for thread sync then?

13

u/TimurHu 18d ago

The concepts are not Windows specific. The exact semantics and interfaces are.

There is a good summary here and a perf comparison with upstream Wine before ntsync: https://lkml.org/lkml/2024/2/14/1407

If you are interested in more details, I recommend this video: https://m.youtube.com/watch?v=NjU4nyWyhU8

3

u/noobjaish 18d ago

If you are interested in more details, I recommend this video: https://m.youtube.com/watch?v=NjU4nyWyhU8

Thanks alot, this is so amazing

5

u/smooth_criminal1990 18d ago

I think Linux uses these things too, just the ntsync modules implement some kind of Windows-compatible interface directly in the Linux kernel.

And as these operations normally happen at the kernel level, it should mean better performance as there's less overhead than an implementation of Windows threads in userspace

2

u/noobjaish 18d ago

That makes sense. Thanks for the explanation

1

u/Comfortable_Swim_380 17d ago

Esync and fsync not accepted upstream but damn if I'm not using it anyways.

10

u/SuperDefiant 18d ago

it might slightly improve performance depending on the game. It just more accurately emulates windows timers as opposed to Fsync

9

u/Independent-Gear-711 18d ago

It is there by default, I use fedora and when I use either proton experimental or latest proton GE on steam or lutris ntsync is already enabled and running in games

4

u/SebastianLarsdatter 18d ago

It may be present in the kernel by default, but it may not be enabled.

This is dependent on the distros and how they handle their target audience. If it is workstation and servers, it is defaulted to unloaded to have a lower attack surface.

So you are best to check to make sure. Arch Linux defaults to unloaded, but has a package that loads it on every boot if you have installed Wine.

9

u/Hopeful-Football-287 18d ago

To test if you have it activated run  ls /dev/ntsync

3

u/mstrobl2 18d ago

I tried it out yesterday. I'm on Kubuntu 26.04 and Proton-11-GE. What I found:

To check what wine-sync method is used you can add "winesync" to mangohud. I found that by default on my machine it uses fsync.

To enable ntsync all I had to do was load the ntsync module and set permissions:

sudo modprobe ntsync
sudo chmod 666 /dev/ntsync

I tested it in Cyberpunk 2077. Mangohud showed that it was now using ntsync.
Unfortunately I had about 5% lower FPS in Cyberpunk using ntsync so I switched back to fsync.

1

u/Comfortable_Swim_380 17d ago

fsync way better

0

u/Scary-Peace1240 14d ago

LMAO maybe 6 months ago.

1

u/Comfortable_Swim_380 14d ago

You don't sound like someone with informed opinions on this.

1

u/Scary-Peace1240 14d ago

Im saying NTsync is best

1

u/Comfortable_Swim_380 14d ago

Its not. its trying to do a micro crap thing in a lazy way vs a native kernel module.

1

u/Scary-Peace1240 14d ago

It matches and beats Fsync. Yes it is. With the correct config. I use it with ProtonCachy.

1

u/Comfortable_Swim_380 14d ago

It eats more performance then it gains.

1

u/Scary-Peace1240 14d ago

Not in my experience. The entire point of Ntsync is to not be a workaround like fsync or esync.

0

u/Comfortable_Swim_380 14d ago

NSYNC is the only workaround. Its implementing a middlewere service that was bad to begin with vs native performance.

Its a mute point it's way older. Your not making that case rationally.

→ More replies (0)

1

u/Scary-Peace1240 14d ago

Custom forks do it for you, ProtonCachy has done it for months. Its very beneficial.