> For the complete documentation index, see [llms.txt](https://eric-lo.gitbook.io/lab4-process/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eric-lo.gitbook.io/lab4-process/wait/sleep.md).

# Sleep

```c
unsigned int sleep(unsigned int seconds);
```

`sleep()` is a system call that can make the process to *sleep* for a specified period.

```c
/* Wait/sleep.c */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>


int main(int argc,char *argv[])
{
    printf("Before fork...\n");
    if(fork() == 0)
    {
        printf("Hello World!\n");
        exit(0);
    }
    sleep(1);
    printf("After fork...\n");
    return 0;
}
```

By using `sleep()`, parent can put to a *suspended* state and wait for the child. However, `sleep()` is not desirable (we need to specify the time...).
