2

How can we prioritize raspberry-pi3b+ model so that if my "code on python" is running then the raspberry-pi should not perform any other task in background. Since i have to calculate time taken by my code to complete operation, and each time i am runnning my python code on raspberry-pi, it is giving different time. So, i need to prioritize. My operating system on raspberry-pi is linux.

Thanks

  • It is a little unclear what you are asking? are you saying that you want 100% of the CPU cores assigned to your python script? does your script support all the cores? are you running an X-server? which linux? Raspbian? please edit your question with more details. read How to Ask for more information – Jonas Stumph Stevnsvig Feb 26 at 8:56
  • 1
    Not Pi specific. – joan Feb 26 at 9:35
  • I'm not sure I understand your question, and I wonder if you are the same. But you might start by reading this article on scheduling. It might help you formulate a better question. – Seamus Feb 26 at 10:17
2

On Unix you can manage the priority of processes with the command nice:

rpi ~$ sudo nice -n -20 script.py

This will run your script with highest priority. The nice value range is -20 to +19 where -20 is highest, 0 default and +19 is lowest. For some more information look at man nice.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.