Question 11
get_exclusive_access ( )
{
if (critical _flag == FALSE) {
critical_flag = TRUE ;
critical_region () ;
critical_flag = FALSE;
}
}
Consider the following statements.Question 12
Question 13
wait (m[i]); wait(m[(i+1) mode 4]); ------ release (m[i]); release (m[(i+1)mod 4]);This could cause:
Question 14
A system has 6 identical resources and N processes competing for them. Each process can request atmost 2 resources. Which one of the following values of N could lead to a deadlock?
Question 15
I. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released. II. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers. III. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers. IV. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources.Which of the above policies can be used for preventing deadlock?
Question 16
A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting value of the semaphore is
Question 17
(i) If no other process is currently holding the resource, the OS awards the resource to P. (ii) If some process Q with TS(Q)<TS(P) is holding the resource, the OS makes P wait for the resources. (iii) If some process Q with TS(Q)>TS(P) is holding the resource, the OS restarts Q and awards the resources to P. (Restarting means taking back the resources held by a process, killing it and starting it again with the same timestamp)When a process releases a resource, the process with the smallest timestamp (if any) amongst those waiting for the resource is awarded the resource. a). Can a deadlock ever arise? If yes, show how. If not, prove it. b). Can a process P ever starve? If yes, show how. If not, prove it.
Question 19
Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is N. Three semaphores empty, full and mutex are defined with respective initial values of 0, N and 1. Semaphore empty denotes the number of available slots in the buffer, for the consumer to read from. Semaphore full denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R and S, in the code below can be assigned either empty or full. The valid semaphore operations are: wait() and signal().
[caption width="800"] [/caption]Which one of the following assignments to P, Q, R and S will yield the correct solution?
Question 20
There are 50 questions to complete.