HW - Lecture 5
12191789 유호현
10-1.
Run the program below. What happens? Explain the result.
- gcc로 컴파일 후 실행함.
fork()
호출 후, parent의 x에는 PID(4499) / child의 x에는 PID(0)
- parent process와 child process가
printf
를 각각 호출하게 되므로 두 번 printf
가 이루어지게 된다.
- child process의 PID가 먼저 출력된 것은 scheduler가 child process를 먼저 schedule 했기 때문이다.
10-2.
Try below and explain the result.