Git Product home page Git Product logo

Comments (3)

Suchiman avatar Suchiman commented on September 22, 2024

I remember stumbling upon this while hacking on the GC, specifically

// Boosts the calling thread's thread priority to a level higher than the default
// for new threads.
// Parameters:
// None.
// Return:
// true if the priority boost was successful, false otherwise.
bool GCToOSInterface::BoostThreadPriority()
{
// [LOCALGC TODO] Thread priority for unix
return false;
}

(which should be fixed as well) but i don't remember the exact reason. I thought i've read the priority cannot be changed after thread creation but that appears to be false.

from corert.

RalfKornmannEnvision avatar RalfKornmannEnvision commented on September 22, 2024

I remember seeing this when porting to the Switch/PlayStation

The place I was refering to is here:

private ThreadPriority GetPriorityLive()
{
return ThreadPriority.Normal;
}
private bool SetPriorityLive(ThreadPriority priority)
{
return true;
}

Edit: Did a quick check. BoostThreadPriority is currently only used by the server GC for the GC threads. But it should be possible to implment it for Unix. But as I currently don't run a server GC I cannot test it

Edit2: Did some more digging. It seems that in many cases the OS is configured in a way that a regular process cannot change the thread priority. Therefore properly nobody cared that much. A quick check in the mono and runtime source showed that both have the code to support it when the OS allows it. Therefore I think we should have it in the same way in CoreRT.

PS: while trying around a little bit i fixed this TODO
// TODO: Figure out which scheduler to use, the default one doesn't seem to
// support per thread priorities.

It still has the limitation that it will only work when the OS allows it but if not it will just do nothing which is the same as now. I can make a PR for it 

from corert.

jkotas avatar jkotas commented on September 22, 2024

. It seems that in many cases the OS is configured in a way that a regular process cannot change the thread priority. Therefore properly nobody cared that much

Yes, that's correct.

It still has the limitation that it will only work when the OS allows it but if not it will just do nothing which is the same as now. I can make a PR for it

💯

from corert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.