来自msdn#microsoft*com/en-us/library/ms686722(v=vs.85)#aspx,Terminating a Process
Terminating a process has the following results:
·Any remaining threads in the process are marked for termination.
·Any resources allocated by the process are freed.
·All kernel objects are closed.
·The process code is removed from memory.
·The process exit code is set.
·The process object is signaled.
While open handles to kernel objects are closed automatically when a process terminates, the objects themselves exist until all open handles to them are closed. Therefore, an object will remain valid after a process that is using it terminates if another process has an open handle to it.
The GetExitCodeProcess function returns the termination status of a process. While a process is executing, its termination status is STILL_ACTIVE. When a process terminates, its termination status changes from STILL_ACTIVE to the exit code of the process.
When a process terminates, the state of the process object becomes signaled, releasing any threads that had been waiting for the process to terminate. For more about synchronization, see Synchronizing Execution of Multiple Threads.
后面的略。
简要说一下,就是,一个进程启动时,操作系统生成一个内核对象(kernel object)来管理其运行,其他进程可以通过与这个对象连接(通过open handle)来获取该进程的信息并与之交互。而当该进程结束后,如果仍有其他进程与该内核对象保持连接,则该对象将继续存在并可访问,直到所有的连接被关闭(close)。
进程结束后,其内核对象可以由于被连接而继续存在,并反映出进程已结束的状态,包括:使用GetExitCodeProcess函数可以取得的,进程的返回值,若进程没有结束则该值是一个命名常量STILL_ACTIVE;这个进程内核对象将处于信号状态(signaled),可以被WaitFor系列函数发现。
Terminating a process has the following results:
·Any remaining threads in the process are marked for termination.
·Any resources allocated by the process are freed.
·All kernel objects are closed.
·The process code is removed from memory.
·The process exit code is set.
·The process object is signaled.
While open handles to kernel objects are closed automatically when a process terminates, the objects themselves exist until all open handles to them are closed. Therefore, an object will remain valid after a process that is using it terminates if another process has an open handle to it.
The GetExitCodeProcess function returns the termination status of a process. While a process is executing, its termination status is STILL_ACTIVE. When a process terminates, its termination status changes from STILL_ACTIVE to the exit code of the process.
When a process terminates, the state of the process object becomes signaled, releasing any threads that had been waiting for the process to terminate. For more about synchronization, see Synchronizing Execution of Multiple Threads.
后面的略。
简要说一下,就是,一个进程启动时,操作系统生成一个内核对象(kernel object)来管理其运行,其他进程可以通过与这个对象连接(通过open handle)来获取该进程的信息并与之交互。而当该进程结束后,如果仍有其他进程与该内核对象保持连接,则该对象将继续存在并可访问,直到所有的连接被关闭(close)。
进程结束后,其内核对象可以由于被连接而继续存在,并反映出进程已结束的状态,包括:使用GetExitCodeProcess函数可以取得的,进程的返回值,若进程没有结束则该值是一个命名常量STILL_ACTIVE;这个进程内核对象将处于信号状态(signaled),可以被WaitFor系列函数发现。