#!/bin/bash CPU1=1 CPU2=1 # Find the PID of the task with priority -98 TASK1_PID=$(top -b -H -n 1 -o PR | awk '$3 == "-98" {print $1}') # Find the PID of the task with priority -99 TASK2_PID=$(top -b -H -n 1 -o PR | awk '$3 == "-99" {print $1}') # Check if the tasks were found if [ -z "$TASK1_PID" ]; then echo "Task with priority -98 not found." exit 1 fi if [ -z "$TASK2_PID" ]; then echo "Task with priority -99 not found." exit 1 fi # Move the task with priority -98 to core 5 taskset -cp $CPU1 $TASK1_PID # Move the task with priority -99 to core 7 taskset -cp $CPU2 $TASK2_PID echo "Task with priority -98 (PID $TASK1_PID) moved to core $CPU1" echo "Task with priority -99 (PID $TASK2_PID) moved to core $CPU2"