- 论坛徽章:
- 4
|
1, 实际开发中, SIGCHLD都是阻塞掉的, 在I/O loop中采用非阻塞的waitpid尝试回收, 不会影响服务端并发程度.
楼主说的忽略SIGCHLD就可以避免僵尸进程, 是一个很特别的特性, 不可移植, 所以不要使用, manpage中是有详细说明的:
POSIX.1-1990 disallowed setting the action for SIGCHLD to SIG_IGN. POSIX.1-2001 allows this possibility, so that ignoring SIGCHLD can be used
to prevent the creation of zombies (see wait(2)). Nevertheless, the historical BSD and System V behaviors for ignoring SIGCHLD differ, so that
the only completely portable method of ensuring that terminated children do not become zombies is to catch the SIGCHLD signal and perform a
wait(2) or similar.
2, 是的, 一直占用, 这个伴随内核的. |
|