

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Information on various operating system concepts, including scheduling algorithms and file systems. Topics covered include average turnaround time, preemption, multi-level feedback-queue scheduling, earliest deadline first, rate monotonic scheduling, proportional-share scheduling, log-based file system (lfs), soft updates, and peterson's algorithm. Students are encouraged to answer questions related to these topics.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


OS comps 10 – 11:30am, 4140 CSE bldg. October 1, 2007 Answer each of the four numbered questions in a separate blue book.
int in0 = 0 , in1 = 0 ; int turn = 0 ;
/* process 0 */
while ( 1 ) { in0 = 1 ; turn = 1 ; while ( in1 && turn == 1 ) ; /* critical section */ in0 = 0 ; }
/* process 1 */
while ( 1 ) { in1 = 1 ; turn = 0 ; while ( in0 && turn == 0 ) ; /* critical section */ in1 = 0 ; } a. You are explaining Peterson’s algorithm to a friend, who observes “This is crazy. The variable turn indicates which process enters the critical section when both wish to enter. Why should process 0 want process 1 to enter? Process 0 should want to enter first! So, process 0 should set turn to 0 (and process 1 should enter turn = 1)”. Is this a good idea? Explain. b. Some multiporcessors do not have atomic memory operations. For example, many architectures locally cache writes until a memory barrier instruction is executed. This works as follows: suppose (shared memory) address 100 contains the value 13. If processor A writes 25 to address 100, the value will be cached at A until processor A issues a memory barrier instruction. The memory barrier instruction forces the cached value back to shared memory. Peterson’s algorithm, as written above, has no memory barrier instructions. Does it correctly implement mutual exclusion on a multiprocessor without them? Explain. If it doesn’t, then insert the fewest memory barrier instructions that will make it a correct implementation and explain why your solution is correct and minimal. You may assume that the operating system scheduler executes a memory barrier instruction immediately before preempting a process from a processor.