I have a single-board computers that runs on a rooted android version. I have an application that uses opencv that demands much CPU usage. Sometimes the performace of the application falls because another process is running on android OS. I wonder is there a way to change the priority of the thread of my application to avoid losing performace. I know that for version not rooted, this is not possible, but for rooted version is there any way to do this?
Asked
Active
Viewed 1,991 times
2 Answers
0
Use renice command, you can change the priority of process. Android use Completely fair queue to schedule process.
For creating new process and change its priority:
nice -n 10 command
#means start command and set its nice value to 10
For processes already running:
toybox renice -p pid -n 10
#means change the pid process nice value to 10, toybox is for Android M
Nice value is between -20 to 19, ps -t -p would show all the process nice value:
USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN PC NAME
root 1 0 1372 780 20 0 0 0 SyS_epoll_ 00000000 S /init
root 2 0 0 0 -2 0 1 1 kthreadd 00000000 S kthreadd
For Non real time process, PRIO = 20 + NICE, smaller value ,higher priority

Jiangty
- 292
- 1
- 6