How do zombies harm?
Asked Answered
T

2

10

From perlipc/Signals:

eval {
  local $SIG{ALRM} = sub { 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?

Tawnyatawsha answered 18/3, 2011 at 10:16 Comment(1)
Yes, there are more ways zombies can harm, such as by eating your brain.Environ
H
11

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.

Hundley answered 18/3, 2011 at 12:23 Comment(0)
L
8

They consume memory and space in the process table.

Lagging answered 18/3, 2011 at 10:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.