Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the state of a program?

I'm observing an program and want to kill it, if it is for some time in the state "wait:executive".

Here is a screenshot of the Process Explorer:

State: wait:executive

How can I get that state by code? Or could maybe tell me somebody what that state exactly mean? This will may help me to find the right query to solve my problem.

like image 339
rekire Avatar asked Sep 24 '12 09:09

rekire


People also ask

What is the state of a program?

What Does State Mean? In computer science, the state of a program is defined as its condition regarding stored inputs.

What are the three states a program can be in?

Thus, the program goes through the required three states: initial, input, and procedure. Typically, a session also goes through the transformation state, but it can be skipped as shown in the example above and in the diagram in the preceding figure.

What is a state in code?

(1) In object-oriented programming, the state of an object is the combination of the original values in the object plus any modifications made to them. (2) The current or last-known status, or condition, of a process, transaction or setting. "Maintaining state" or "managing state" means keeping track of the process.

What is state change programming?

In general changing in state of the program occurs when the program alters some computer resource (eg. memory value at a given address) within the process address space related to the process your program is represented by and that change will have an effect on further execution of the process.


1 Answers

It is not state of program but it's state of thread.One process can have many threads.

You can call WaitForSingleObject to determine some states.

Also you can instantiate WMI using COM and selecting Win32_Thread class.

Here is some example.

More info here : How to determine that a win32 thread is either in Wait or Join or Sleep state in c++

like image 155
rkosegi Avatar answered Oct 03 '22 02:10

rkosegi