POSIX系统上的僵尸线程 [英] Zombie Threads on POSIX systems

查看:51
本文介绍了POSIX系统上的僵尸线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

僵尸线程如何在C/C ++中形成,并且您需要确保做什么以防止它们被创建?我知道它们只是无法正常终止的普通线程,但是我对具体细节有些困惑.

How do zombie threads get formed in C/C++, and what do you need to make sure to do in order to prevent them from being created? I know they're just normal threads that didn't terminate properly, but I'm a little hazy on the specifics.

推荐答案

僵尸线程是可连接的线程,该线程已经终止,但是 还没有加入.通常,任何一个线程都应该在某个位置连接 时间,否则应该分开.否则,操作系统将保持其状态 以便将来可能需要加入,这会占用资源.

A zombie thread is a joinable thread which has terminated, but which hasn't been joined. Normally, either a thread should be joined at some time, or it should be detached. Otherwise, the OS maintains its state for some possible future join, which takes resources.

这篇关于POSIX系统上的僵尸线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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