# Problem 2: Zombies!

The following code simulates a shell that executes `ls` in each round.

```c
/* Wait/problematic2.c */
#include <stdio.h>
#include <unistd.h>
int main(int argc,char *argv[])
{
    while(1)
    {
        printf("Press Enter to execute ls");
        while(getchar() != '\n');
        if(!fork())
        {
            execl("/bin/ls","ls",NULL);
        }
        else
        {
            sleep(1);
         }
    }
    return 0;
}
```

The program will run without _apparent_ problems. However, if you look at the system process...

![](https://848802932-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lp-5TQgFcJFf9qOBUEC%2F-Lp-5ZB50WXwtZaIRVKh%2F-Lp-63Bp0TY6Jd-UGrx8%2Fzombies.png?generation=1568738711410941\&alt=media)

Zombies appear!!

This is the consequence of the mishandling in the parent process- the parent ignores the `SIGCHLD` signal.
