Getting process details on an operating system process/question answer by vouce

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jul 16 10:24:26 EDT 2018


On Mon, 16 Jul 2018 06:47:53 -0600, John T. Haggerty wrote:

> So, it's early for me---and I'm not sure if these things can be done but
> I'd like to know the following:
> 
> 1. How can Python connect to a running operating system process on a
> host operating system to see what part of the execution is like?---ie
> keep track of health stats like it's stuck on disk access or inside some
> kind of wait state etc.

Start by answering the question: "How can *any* process connect to 
another running process ...". Once you know how to do that, that may give 
us a hint how to do the same using Python.

I would expect that there needs to be some sort of OS-specific interface 
where you pass the process ID you care about to some OS function, and it 
will report the process state.

If your operating system doesn't support that, the only other option that 
I know of is if the application you are interested in *itself* provides 
an interface to question it while it is running. On Linux, that might 
including sending it a signal (see the signal.py library) or it might 
include some form of interprocess communication. But whatever it is, it 
will likely be application specific.

So if the OS doesn't support this, and the process you are interested in 
doesn't support this, then it likely can't be done.


> 2. Be able to pass questions and take answers via say a customized "okay
> google" to try to explain:
> 
> Ask: how was your day
> record answer in voice translate it via google ask new question

Sorry, I don't understand this.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list