Reputation: 138
I'd like to set SCHED_RR (and priority) on all threads of a particular foreign process.
What would be the best way, to do it from shell and another case - programatically from another process when it creates it as a child. Thanks!
I suck at shell scripting, and don't know how to run "chrt" for all threads of a process, just in case that matters, threads have different names.
Upvotes: 4
Views: 3006
Reputation: 46
You can also use the -a argument.
chrt -p -r -a ${mainpid}
Note that this wouldn't change the priority of the threads that would start in future after you run chrt.
Upvotes: 3
Reputation: 4606
Try this, to rise the priority of udevd:
display priority of all threads of a process
$ for p in $(pidof udevd); do chrt -p $p; done
sample output
pid 1249's current scheduling policy: SCHED_OTHER
pid 1249's current scheduling priority: 0
pid 1248's current scheduling policy: SCHED_OTHER
pid 1248's current scheduling priority: 0
pid 788's current scheduling policy: SCHED_OTHER
pid 788's current scheduling priority: 0
rise the priority of all threads of a process
$ for p in $(pidof udevd); do chrt -p 45 $p; done
sample output:
pid 1249's current scheduling policy: SCHED_OTHER
pid 1249's current scheduling priority: 0
pid 1249's new scheduling policy: SCHED_RR
pid 1249's new scheduling priority: 45
pid 1248's current scheduling policy: SCHED_OTHER
pid 1248's current scheduling priority: 0
pid 1248's new scheduling policy: SCHED_RR
pid 1248's new scheduling priority: 45
pid 788's current scheduling policy: SCHED_OTHER
pid 788's current scheduling priority: 0
pid 788's new scheduling policy: SCHED_RR
pid 788's new scheduling priority: 45
Upvotes: 0