究竟会发生什么,当我的过程中被杀害?我的、被杀、过程中、发生

2023-09-04 22:54:42 作者:ぺ寂寞的小兵

我有一个混合的过程,本机和托管code,Windows Server 2003上运行。

I have a mixed process with native and managed code, running on Windows server 2003.

当我杀死我的过程中从内部的Process Explorer它进入状态100%的CPU和前走开保持这样的一段时间(有时甚至是10分钟)。在此期间,我不能杀,或做任何其他事情。

When I kill my process from within process explorer it goes into a state of 100% cpu and stays like that for a while (sometimes even 10 minutes) before going away. During this time I cannot "kill" it or do anything else.

发生过程什么exaclty当我通过,通过进程管理器的追杀过程中杀死它? 我认为,这不叫任何析构函数,所以这可能是造成这种cpu使用率?

What exaclty happens to a process when I kill it via process via process explorer's kill? I believe this does not call any destructors, so what could be causing such cpu usage?

谢谢, 丹

推荐答案

试试看使用任务管理器结束进程(在进程选项卡),而是和尝试,如果你选择杀死进程树在任任务管理器或Winternal的出现是否是有差别Process Explorer的,但我怀疑这会帮助你。

Try it using End Process (on Process tab) of Task Manager instead, and try whether there's a difference if you choose Kill Process Tree on either Task Manager or Winternal's Process Explorer, however I doubt it'll help.

的方法应该被杀死(几乎)即刻,但是,也有一些欺骗性方法留下来。如果你写你自己的应用程序,我认为不是这样的。它更多的则可能是其他进程不喜欢你被带走。设置过程监视器上进行快速的刷新速度与CPU的列进行排序。现在,您应该看到是哪个进程导致100%的问题。最有可能的:系统

The process is supposed to be killed (almost) instantly, however, there are some sneaky ways to stick around. If you wrote your own application, I assume that isn't the case. It is more then likely that other processes don't like yours being taken away. Set Process Monitor on quick refresh speed and sort the cpu column. You should now see which process is causing the 100% issue. Most likely: system.

在您使用大量的内存,尤其事件。当它的比物理存储器整体越多,该系统将重新组织(即从磁盘移动存储器回到物理存储器)。类似的行为发生(直到冻结我的系统)时,我杀了火狐后,我打开500+选项卡,占用1.5GB内存。这种行为(慢改组内存)与更高版本的Microsoft Windows有所改善。

In the event that you use a lot of memory, esp. when it's overall more than the physical memory, the system will reorganize (i.e., move memory from disk back to physical memory). A similar behavior occurs (up until freezing my system) when I kill Firefox after I open 500+ tabs, occupying 1.5GB memory. This behavior (slowly reorganizing memory) has improved with later versions of Microsoft Windows.

更新:内部,PROC EXPL。调用TerminateProcess(其中包括),其中强制关闭所有句柄和线程。该 MSDN API参考说的 TerminateProcess启动终止并立即返回。这将停止执行过程中的所有线程,并要求取消所有挂起的I / O的。在终止进程不能退出,直到所有挂起的I / O已经完成或已取消。的。这意味着这么多。(虽然我不知道它是如何把你的过程中100%,I / O通常不这样做),你的I / O可以阻止这个过程

UPDATE: internally, proc expl. calls TerminateProcess (amongst others), which force-closes all handles and threads. The MSDN API ref says "TerminateProcess initiates termination and returns immediately. This stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled.". Which means so much as: your I/O can block this process (though I wonder how it can bring your process to 100%, I/O usually doesn't do that).

 
精彩推荐
图片推荐