开发者

How do zombies harm?

开发者 https://www.devze.com 2023-02-17 20:05 出处:网络
From perlipc/Signals: eval { local $SIG{ALRM} = s开发者_JS百科ub { die \"alarm clock restart\" }; alarm 10;

From perlipc/Signals:

eval {
  local $SIG{ALRM} = s开发者_JS百科ub { die "alarm clock restart" };
  alarm 10;
  flock(FH, 2); # blocking write lock
  alarm 0;
};
if ($@ and $@ !~ /alarm clock restart/) { die }

If the operation being timed out is system() or qx(), this technique is liable to generate zombies. If this matters to you, you'll need to do your own fork() and exec(), and kill the errant child process.

I have a similar code, where the operation being timed out is system() or qx().

Is the bad thing about zombies that they consume memory or are there more ways zombies can harm?


The primary issue is that they consume process table slots. Linux's process table can hold 64k entries, so this isn't likely to result in problems unless you do a lot of forking without cleaning up the zombies. I expect that most, if not all, other modern *nixes have process tables of the same size. It does look ugly when you run ps, though.

Memory isn't really a problem, as each zombie only takes up a few bytes to record its exit status.


They consume memory and space in the process table.

0

精彩评论

暂无评论...
验证码 换一张
取 消