i am new to shell scripts. I have task where i have to create multiple instances of a c program, run them in background and alter their scheduling policy using chrt utility.
In chrt utility i need to give the process IDs for every process to alter it's scheduling policy.
Now i have to add all these in a shell script to automate the process.
My question is, after creating the instances, how do i fetch the process ID of every instance and store it in a variable?
gcc example.c -o w1
taskset 0x00000001 ./w1&
taskset 0x00000001 ./w1&
taskset 0x00000001 ./w1&
taskset 0x00000001 ./w1&
pidof w1
chrt -f -p 1 <pid1>
pidof w1 will give the process ids of all the instances. Now how do i store all these IDs in variables or array and pass them in chrt command?