dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 510 forks source link

UNIX: Higher Thread priority #8333

Closed RalfKornmannEnvision closed 3 years ago

RalfKornmannEnvision commented 3 years ago

implements GCToOSInterface::BoostThreadPriority & PalStartBackgroundWork highPriority

The default scheduler SCHED_OTHER doesn't have different priorities. This implementation tries to switch to 90% of the max priority of the SCHED_RR policy if the current policy don't allow different priorities.

But as this requires special privileges it might fail. In this case these thread will have the same priority as all the others. Therefore in the worst case anything will behaves like before. In the best cases these thread will have a higher priority as planend.

jkotas commented 3 years ago

@janvorli Could you please take a look at this? I would like to avoid differences between CoreCLR and CoreRT, but I am not sure what the right thing to do is here.

jkotas commented 3 years ago

I think this needs to some tests or benchmarks that demonstrate the improvement. Do you have any tests like that?

It would be best to make the change in dotnet/runtime for CoreCLR first, and then port it to CoreRT. dotnet/runtime has dedicated people to check for performance regressions in different scenarios. If this were to cause any unexpected regressions (or improvements), we will be able to catch in dotnet/runtime.

RalfKornmannEnvision commented 3 years ago

Most likely it would improves things only in some edge cases. Might not worth all the hassle. I any case I will close this here for now.