当我的进程被杀死时会发生什么? [英] What exactly happens when my process is killed?

查看:171
本文介绍了当我的进程被杀死时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我在进程管理器中杀死我的进程时,它进入一个状态100%cpu,并停留一段时间(有时甚至10分钟),在离开之前。在这段时间内,我不能杀死它或做任何其他事情。



当我通过进程通过进程管理器杀死它的进程杀死了什么exaclty?
我相信这不会调用任何析构函数,所以可能导致这样的cpu使用?



谢谢,

解决方案

尝试使用任务管理器的结束进程(在进程选项卡),并尝试是否有区别,如果你选择杀死进程树任一任务管理器或Winternal的进程资源管理器,但我怀疑它会有所帮助。



这个进程应该立即被杀死,但是,有一些鬼鬼祟祟的方法。如果你写了自己的应用程序,我认为不是这样。它更可能是其他进程不喜欢你的被带走。在快速刷新速度上设置Process Monitor,并对cpu列排序。您现在应该看到导致100%问题的进程。很可能:system。



如果你使用大量的内存,esp。当它总体上超过物理存储器时,系统将重新组织(即,将存储器从磁盘移回物理存储器)。类似的行为发生(直到冻结我的系统),当我杀了Firefox,我打开500+选项卡,占用1.5GB内存。这种行为(缓慢重组内存)在Microsoft Windows的更高版本中有所改进。



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


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

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.

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?

Thanks, Dan

解决方案

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.

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.

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.

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).

这篇关于当我的进程被杀死时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆