This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: core image. (b) (1 pts) What does the fork() system call return? Explain all cases. Answer: It returns the childs process id for the parent process and a 0 for the child process. (c) (1 pts) How does a program make use of the return value of the fork() system call? Answer: As the child process has an exact copy of the core image of the parent process, when it is scheduled it executes the same program (starting with the next instruction after call to fork()) that the parent process executes. So to be able to distinguish the statements that the parent process executes from the ones the child process executes, the program can have an if-statement to check the return value of the fork() system call, i.e.: if ((pid = fork()) == 0) do child stuff else do parent stuff 2...
View Full Document
- Fall '07
- Operating Systems