Home > Software engineering >  About the TerminateProcess and OpenProcess use problem
About the TerminateProcess and OpenProcess use problem

Time:10-29

Do not know to have any other processes in the Windows API TerminateProcess killed after, still can use OpenProcess access to handle to the process, to see the next task manager, the ID of the process being killed are really wasn't there, is there a more reasonable explanation?

CodePudding user response:

This depends on whether the moment system cleaning process information, etc., need to see if the kernel atomic operation, etc

CodePudding user response:

reference 1st floor oyljerry response:
this depends on whether the moment system cleaning process information, etc., need to see if the kernel atomic operations such as


Per second heartbeat to detect the existence of the process and found OpenProces was able to open this process has to be shut down

CodePudding user response:

That is, system is not recycled or the handle is allocated to other processes

CodePudding user response:

After the TerminateProcess WaitForSingleObject (PROCESS_HANDLE, INFINITE);

CodePudding user response:

reference oyljerry reply: 3/f
that's system is not recycled, or the handle is allocated to other processes

System is not recycled, but in the task manager did not find the process ID, so wonder if the process is complete recovery, do you have any ideas? MSDN if this process is the explanation of IO operations, will be done in IO operations by the kernel again after a thorough cleaning, waited for about 20 minutes, found that this process can still OpenProcess ID,

CodePudding user response:

reference 5 floor qq_28026991 reply:
Quote: refer to the third floor oyljerry response:

That is, system is not recycled or the handle is allocated to other processes

System is not recycled, but in the task manager did not find the process ID, so wonder if the process is complete recovery, do you have any ideas? MSDN if this process is the explanation of IO operations, will be done in IO operations by the kernel again after a thorough cleaning, waited for about 20 minutes, found that the process ID, or can OpenProcess

There are other procedures reference it?

CodePudding user response:

refer to 6th floor VisualEleven response:
Quote: refer to the fifth floor qq_28026991 reply:

Quote: refer to the third floor oyljerry response:

That is, system is not recycled or the handle is allocated to other processes

System is not recycled, but in the task manager did not find the process ID, so wonder if the process is complete recovery, do you have any ideas? MSDN if this process is the explanation of IO operations, will be done in IO operations by the kernel again after a thorough cleaning, waited for about 20 minutes, found that the process ID, or can OpenProcess

There are other procedures reference it?

No, the only possible place is between the two processes have Shared memory

CodePudding user response:

"Windows programming revelation"
In 19.6 why some processes are terminated after still stays in the task manager
When the end of a process (end of may be normal, it may also be because calls like the TerminateProcess function), the process of user mode module will be deleted, but only in the kernel configuration module is associated with the thread of all drivers will be deleted after completion of execution,
For example, if a thread is in the midst of the I/O operations, so will give responsible for the I/O driver sends a kernel signal to cancel the operation,
If the driver's behavior is good, then it will be cleared with the outstanding I/O and some information about the release thread,
If the driver's behavior is not good (probably because the hardware driver management appears strange behavior), you may need to take a long time to clear the outstanding I/O, in this time, the driver will not release the thread (and) the thread's process, the actual situation is more complicated, but this simple model is sufficient for our discussion,
.
, in other words, if you stopped after a process can also see the process in task manager, so, in fact, the process has stopped running, but also some of the residual information retained in the system, only when all drivers are associated with the process to complete the cleaning operation and points to handle to the process have closed, the process will disappear completely,
  • Related