I have a python program that uses a lot of my CPU's resources. While it is fine on my regular PC, I'm afraid it might be too much to handle for my Raspberry Pi. Speed is not an issue. I don't care if my code is executed slowly as I am implementing a real time system that executes the code only once every few hours, but my CPU needs to be freed up as I would also be running other processes simultaneously. Is there anyway I can reduce the resources that it takes from the CPU at the cost of speed of execution? Any help would be appreciated, thank you
While you sure can tinker with your program and make it more optimized, the fact is that all programs are generally designed to take as much CPU as they need in order to finish in smallest time possible.
I see two ways to achieve your goal:
Raspberry pi is Linux right? So just lower process priority of the python interpreter running your script. this would make sure that other programs can have CPU if they need it
In your script, sleep for few milliseconds every few milliseconds.. ugly, but could do the trick
But option one is probably way to go.