CS 140 Midterm: CS 140cs140 midterm fall 2004

37 views8 pages
31 Jan 2019
Course
Professor

Document Summary

October 29th, 2004 (total time = 50 minutes, total points = 50) In recognition of and in the spirit of the stanford university honor code, i certify that i will neither give nor receive unpermitted aid on this exam. This examination is close notes and close book. You may not collaborate in any manner on this exam. You have 50 minutes to complete the exam. Before starting, please check to make sure that you have all 8 pages. Initials:______: (9 points) you are implementing an os with a partner. You ask your partner to write some synchronization functions: lock(l) - locks l. unlock(l) - unlocks l. sleep() - makes the current thread sleep until woken with wake(). wake(t) - wakes thread t. Your partner decides include several combination functions: lock_sleep(l) atomically lock(l) then sleep(). unlock_sleep(l) - atomically unlock(l) then sleep(). lock_wake(l,t) atomically lock(l) then wake(t). unlock_wake(l,t) atomically unlock(l) then wake(t).