How to kill one particular instance out of multiple

I have a computer system consisting of an industrial grade computer with 2 display cards, 1 ps/2 mouse, 1 ps/2 keyboard, 1 serial mouse

My computer is running first instance of Photon on monitor1. This photon accepts input from PS/2 mouse and PS/2 keyboard.
2nd instance of photon is configured to run on monitor 2. Photon configured to run on monitor2 accepts input from serial mouse.

I have observed that for my system, total 3 instances of Input process are running. I wish to programmatically kill the instance which communicates with serial mouse and reinvoke the same. With the help of my program, how to find out which of the 3 pids (output of sin) correspond to the one which allows our system to communicate with serial mouse?

maybe “sin args” will show the show the command line arguments to Input and you will then be able to find out which is for the serial mouse.