I want to run 2 different program at the same time. First one is a python script. Other program is a simulation program (Gazebo). Briefly, I want to send command from python script to Gazebo simulation. I already know ROS and multiprocessing but my problem not about these. While Gazebo is working, python script's fps value decreasing. So I want to run python script by choosing an CPU without effect Gazebo. Also I want to run Gazebo by choosing another CPU core. My request different from multiprocessing because even I didn't connect python script to Gazebo, fps is decreasing. For example I am starting python script. After that I am starting Gazebo from another terminal. These are independent works. Even in this situation they are affecting each other. As a result, even if I use multiprocess they will effect each other. Am I wrong? What should I do for this problem.
Edit: I could also ask the question in different type: Let's say we have 2 different python scripts. Both python scripts use multiprocessing. I created 2 processes in both scripts. When I run these 2 files in different terminals, will 4 different CPUs be used in total? Briefly, is the process used by a python file different or the same as the process in other python code run from a different terminal?
CodePudding user response:
The python executable then happens to typically load a text file and do something with it (your_script.py
), but that actually has less to do with how the process is managed. When you call multiprocessing
in your script python will use some OS commands to start an entirely new process just like opening a new terminal window (though it won't generally get it's own actual gui window)