What is the problem with this code? How to solve it? Parent processes goto in if or child process?
first code produce zombie process or second code or both or non ?
#include <signal.h>
#include <sys/wait.h>
main() {
for (;;) {
if (!fork()) {
exit(0);
}
sleep(1);
}
}
what about this code :
#include <signal.h>
#include <sys/wait.h>
main() {
for (;;) {
if (fork()) {
exit(0);
}
sleep(1);
}
}