CS350 Midterm: S14-midterm.pdf

66 views12 pages
8 Oct 2014
Course
Professor

Document Summary

Number of exam pages (including this cover sheet) Consider the application code below, which uses the fork and waitpid system calls. int i; dofork() { pid t pid; int status; i++; pid = fork(); if (pid == 0) { /* child */ printf(%d,i); return; Note that the state- ment printf(%d,i); will print the value of integer variable i. You should show the combined output of all processes. Your answer should be a single sequence of numbers: (2 marks) suppose that the call to waitpid is removed from the dofork function, and the modi ed program is then run. Give an example of output that could be produced by this modi ed program, but that could not be produced by the original, unmodi ed program. Again, your answer should be a single sequence of numbers. In this question, you are asked to consider a type of lock with a richer interface than that used by locks in os/161.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents