cop4600-fa07-quiz1Solutions

cop4600-fa07-quiz1Solutions - core image. (b) (1 pts) What...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COP4600 Operating Systems Quiz 1 Thursday, September 13th 2007 Prepared by Tuba Yavuz-Kahveci University of Florida tyavuz@cise.ufl.edu Student Information First Name: Last Name: UFID: Signature: Questions 1. (2 pts) This question has two parts: (a) (1 pts) What is multiprogramming? Answer: In multiprogramming a CPU rapidly switches back and forth from one process to another to give the illusion of parallel execution of the processes. (b) (1 pts) How does multiprogramming increase CPU utilization? Answer: When a process blocks for some reason the CPU switches to another process that is ready and so decreases the CPU idle time and hence increases CPU utilization. 2. (3 pts) This question has three parts: (a) (1 pts) What does the fork() system call do? Answer: Creates a child process that has the exact copy of the parent’s
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 2

cop4600-fa07-quiz1Solutions - core image. (b) (1 pts) What...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online