Process-Management

Question 1

In a certain operating system, deadlock prevention is attempted using the following scheme. Each process is assigned a unique timestamp, and is restarted with the same timestamp if killed. Let Ph be the process holding a resource R, Pr be a process requesting for the same resource R, and T(Ph) and T(Pr) be their timestamps respectively. The decision to wait or preempt one of the processes is based on the following algorithm.

if T(Pr) < T(Ph) then 
      kill Pr
else 
      wait
Which one of the following is TRUE?

A
The scheme is deadlock-free, but not starvation-free
B
The scheme is not deadlock-free, but starvation-free
C
The scheme is neither deadlock-free nor starvation-free
D
The scheme is both deadlock-free and starvation-free
Question 1 Explanation: 
When the process washes up again after it has been killed once or twice, it will have same time stamp as it had when it was killed first time. And that time stamp can never be greater than a process that was killed after that or a new process that may have arrived. So, every time when the killed process washes up it might always find a new process that will say "your time stamp is less than me and I take this resource", which of course is as we know, and that process will again be killed.
So, starvation is possible, but deadlock is not possible.
Question 2

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

P1:	              P2:
Compute:              Compute; 
Use R1;               Use R1;
Use R2;               Use R2;  
Use R3;               Use R3;
Use R4;	              Use R4; 

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 access 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?

A
1
B
2
C
3
D
4
Question 2 Explanation: 
It needs two semaphores such as X=0; Y=0
There are 2 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access