devops-exercises/topics/os/fork_102.md

20 lines
291 B
Markdown
Raw Normal View History

2021-07-22 19:45:06 +02:00
## Fork 101
Answer the questions given the following program (without running it):
```
#include<stdio.h>
#include <unistd.h>
2021-07-22 19:45:06 +02:00
int main()
{
fork();
fork();
printf("\nyay\n");
return 0;
2021-07-22 19:45:06 +02:00
}
```
1. How many times the word "yay" will be printed?
2. How many processes will be created?