CSC 414 Problems Session II, Spring 2007

Notre Dame University–Louaize · Applied Operating Systems · 1 page · Dr. Khaldoun El-Khaldi

All CSC 414 files
CSC 414 Problems Session II, Spring 2007, page 1

Stuck on a question? A tutor can walk you through it.

More CSC 414 files

Show the text of this problems
1. (5 points) Allocating Memory for Processes A certain editor has 100K of program text, 80K of data. The stack is 10K. Suppose 3 copies of this editor are started simultaneously. How much physical memory is needed (a) if shared text is used, and (b) if it is not? With shared text, 100K is needed for the text. Each of the 3 processes needs 80k for its data segment and 10k for its stack, so the total memory needed is 370K. Without shared text, each program needs 190k, so 3 of them need a total of 570k. 2. (10 points) Fork system call As megabyte programs become more common, the time spent executing the FORK system call grew proportionally. Worse yet, nearly all of this time was wasted since most porgrams call EXEC shortly after forking. To improve performance, Berkeley invented a new system call, VFORK, in which the child shares the parent's address space, instead of getting its own copy of it. Describe a situation in which a poorlybehaved child can do something that makes the semantics of VFORK fundamentally different from those of FORK. The child can change a few variables and then exit. With FORK, the parent is guaranteed that nothing the child can do will affect the parent's address space. with VFORK, this guarantee is no longer valid, introducing the possiblity of hardtofind bugs.