Time Left - 15:00 mins

Synchronization and Deadlock

Attempt now to get your rank among 43 students!

Question 1Multiple Correct Options

Consider a system with 3 types of resources R1, R2, and R3 in quantity 5,7,5 respectively. The allocation and Max matrices are given below:

Which of the below are Safe sequences?

Question 2

Consider the following two-process synchronization solution
Process 0
---------
Entry: loop while (turn == 1); (critical section)
Exit: turn = 1;
Process 1
-----------
Entry: loop while (turn == 0); (critical section)
Exit: turn = 0;
The shared variable turn is initialized to zero. Which one of the following is TRUE?

Question 3

Which of the following is not correct about "monitors"?

Question 4

Two concurrent processes P1 and P2 use four shared resources R1, R2, R3 and R4, as shown below.

Both processes are started at the same time, and each resource can be accessed by only one process at a time. The following scheduling constraints exist between the accesses of resources by the processes:
P2 must complete use of R1 before P1 gets access to R1
P1 must complete use of R2 before P2 gets access to R2
P2 must complete use of R3 before P1 gets access to R3
P1 must complete use of R4 before P2 gets access to R4
There are no other scheduling constraints between the processes. If only binary semaphores are used to enforce
the above scheduling constraints, what is the minimum number of binary semaphores needed?

Question 5Multiple Correct Options

Consider the following solution to a problem known as “Too much milk” problem which says that there shouldn’t be more than one milk packets in the fridge. Thread A and Thread B buy the milk packet. If there is none milk packet in the fridge then either Thread A or Thread B can buy the milk and put it into the fridge.

We have a milk variable which is initialized to 0 and it indicates the number of milk packets in the fridge. For synchronisation and for achieving the goal of “never making milk  2”, we present the following solution where noteA and noteB are two shared variables for the purpose of synchronisation.

Note that the buyMilk function will increment the milk variable.

Which of the following is true for the above attempt/solution to solve the Too much milk problem?[Multiple- Select Question]

  • 43 attempts
  • 0 upvotes
  • 0 comments
May 14GATE & PSU CS