supernoob
Posts: 8
Joined: Tue Jun 19, 2012 4:25 pm

Multiple python script faster in different sessions?

Mon Jun 16, 2014 3:18 pm

Hi all,
I've developed three python modules that I usually run with:

Code: Select all

sudo python process1.py &
sudo python process2.py &
sudo python process3.py &
Three python modules makes operation over two different xml files.

If I run all of them in the same session (for example through a .sh script or starting them manually)  seems that elaboration time is about a 30% more (slower).
If I run all of them in separate sessions all seems to be faster.

Questions:
1 - why is this happening ?
2 - how I could automatically run (after boot) these three script in three separate sections ?

Thanks very much,
regards to all.

SuperNoob

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Multiple python script faster in different sessions?

Wed Jun 18, 2014 4:37 pm

use 'time' to get some real numbers, then to it 10 more times to see if it's consistant.
use nice if you want to give one priority
read about scheduling: http://en.wikipedia.org/wiki/Scheduling ... nux_2.6.23
use init.d to run after boot.
use screen or tmux or nohup and check printenv to use different sessions


more swapping between tasks will slow things down... why are you running these in parallel?
it would probably be faster and definitely less memory intensive if you did your parallelism in python.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

Return to “Python”