Sample Header Ad - 728x90

How can taskset create pid when the program is not running yet?

4 votes
1 answer
2423 views
I want to limit the processing capability to only a single core in my machine, so I found out taskset can help to set a single core, say core 0, as the following (Courtesy to this answer ): taskset -c 0 -p 45678 The problem is that how can I determine the process_id pid here when my program is not running yet? Do we just set an arbitrary process id to be picked up by Linux, in this case 45678? If it is so, is it possible to do that in a shell script as the following: #!/bin/sh # Set the processing unit taskset -c 0 -p 45678 # run python script python main.py
Asked by Katherine (87 rep)
May 6, 2018, 04:55 PM
Last activity: May 6, 2018, 05:48 PM