Sample Header Ad - 728x90

How do I enforce all commands (including many parrallel commands) in a script to run on a specifc few cores?

0 votes
1 answer
711 views
I'm trying to write at the beginning of my script some code that will ensure every command inside the script is run on just a few specific cores. even if many commands are run in multiple parallels like : [command] & [command] & [command] & [command] & [command] , I want them to only run on the few selected cores. Currently the script looks for its own PID when it starts, and then feeds that into taskset, where I tell it that its PID is only allowed to use cores 1 to 3. An example taskset command looks like: taskset -c 1-3 -p 45678 But as soon as some parallel commands start, they each get there own PID and are know longer restricted to the allocated cores. How do I make sure everything in the script stays in the desired cores?
Asked by Giles (897 rep)
Oct 2, 2019, 01:05 PM
Last activity: Oct 2, 2019, 01:23 PM