linuxmultithreadingschedulerrenice

How to change priority of specific thread (LWT) in Linux?


It's possible to see priorities and scheduling policies of all threads of a process like that:

ps H -o 'tid pri cls comm' PID

How to change the individual thread priorities from the command line?

The commands like renice and chrt seem to affect the whole process, but I'm searching the critical path among the threads. Is there maybe anything useful in /proc?


Solution

  • You can use chrt

    Example:

    sudo chrt -r -p 40 1502
    

    where 40 is the priority and 1502 is the TID

    second column from ps -eLo pid,tid,rtprio,ni,comm output