Computer Science 322 Quiz 7 Name_____________________ 1. For Peterson's algorithm to function correctly, the setting of the "turn" and "p1using" variable a. Must occur in the order b. Must occur in the order p1using before turn. turn before p1using. 2. If the two variables are set in the wrong order the problem that can arise is: a. deadlock b. livelock c. both processes in the critical section at the same time 3. Westall's "write buffering" hack may be necessary to get Peterson's algorithm to work correctly a. Only on single CPU systems b. Only on Multiprocessor systems c. On both single CPU and multiprocessor systems 4. Suppose Westall's extended tree structured version of Peterson's algorithm is used to provide mutual exclusion for 16 distinct threads. The number of distinct instances of the struct pete_lock_type that will be required is: a. 6 b. 7 c. 14 d. 15 e. 16 5. Suppose (a correct) Peterson's algorithm is being used to protect access to a critical section by two competing threads on a single CPU machine. Which of the following statements best describes how this mutex mechanism will work: a. once thread 0 enters the critical section it cannot be preempted until it exits the critical section b. thread 0 can be preempted but as long as its in the critical section thread 1 can't be dispatched (scheduled) c. thread 0 can be preempted and thread 1 can be dispatched, but thread 1 will be stuck in a loop as long as thread 0 remains in the critical section d. thread 0 can be preempted and its possible for thread 1 to be dispatched but if it is dispatched, both threads can be in the critical section a the same time.