htop icon indicating copy to clipboard operation
htop copied to clipboard

possibility to change real-time priorities

Open juanschroeder opened this issue 2 years ago • 1 comments

Hi guys,

htop is a great tool. Thanks for your effort. I've used it in the context of real-time systems and it would be great if I could change realtime priorities with htop the way 'niceness' can be easily changed. For the moment I use 'chrt' tool, but having it in htop would be great. If I am not mistaken this is not possible.

Thanks!

juanschroeder avatar Apr 21 '22 11:04 juanschroeder

We'd need to show the RT priority (and scheduler) first. Then we could have a menu like i for setting the IO priority. We use F7 / F8 for process priority (niceness), Shift-F7 / Shift-F8 for autogroup priority. Ctrl-... is still available :-).

Of course this could also be sorted with an "external commands" menu or more flexible binding of (arbitrary) commands to keypresses, cf. https://github.com/htop-dev/htop/issues?q=is%3Aissue+is%3Aopen+external .

fasterit avatar Apr 21 '22 15:04 fasterit

Hey, I had the same idea today. However, this seems to be completed with https://github.com/htop-dev/htop/pull/1162. It would still be nice to be able to change the priority directly (without pressing Y and then selecting the scheduling policy first). Would you accept a PR that you can press (e.g.) "P" and then the priority selection pops up when the scheduling policy is FIFO or RR?

lbckmnn avatar Feb 07 '23 20:02 lbckmnn

Doesn't changing the scheduling priority with F7 / F8 end up the same?

fasterit avatar Feb 08 '23 06:02 fasterit

No F7 and F8 only changes the niceness. The priority is a different concept and only used/meaningful with SCHED_FIFO and SCHED_RR.

lbckmnn avatar Feb 08 '23 10:02 lbckmnn

Well, then I'd opt for Ctrl-F7 and Ctrl-F8 as per https://github.com/htop-dev/htop/issues/980#issuecomment-1105389744 above

fasterit avatar Feb 08 '23 14:02 fasterit

Wouldn't that be confusing?

Niceness and Priority are somewhat different concepts. You can even change the niceness of a SCHED_FIFO Thread/Process, it just doesn't do anything.

Would you then also change the labels in the main menu depending on the scheduling policy of the selected thread? (NICE +/NICE - for SCHED_OTHER,SCHED_BATCH,SCHED_DEADLINE and e.g .Priority+/Priority- for SCHED_FIFO, SCHED_RR)? Is that even possible without bigger changes?

Also what would happen if threads/processes with different scheduling policies are selected?

lbckmnn avatar Feb 08 '23 20:02 lbckmnn