The Gateway to Computer Science Excellence
0 votes

Consider the following solution for critical section problem with 'n' processes P0,P1,P2,......P(n-1).For all i,number[i] is an integer array initialized to zero, and for all j,choosing[j] is a binary array initialized to false.



     Repeat   {

       number[j]= max(number[0],number[1],.......................number[n-1])+1;


        for j=0 to n-1

        do begin

        while(choosing[j]) do nothing;

        while(number[j]!=0 and (number[j],i) < (number[i], i))

        do nothing;


        critical section;


         remainder section;

         }until false;

consider the following statements about above solution:

S1:solution preserve first come first serve property.

S2:solution follows mutual exclusion condition.

S3:solution leads to starvation.

Which of the following is correct.

a)S1 only.

b)S1 and S2 only.

c)S2 and S3 only.

d)S1 , S2 and S3

(please anyone elaborate this solution.thanks in advance)

in Operating System by Active
edited by | 93 views
@bikram sir @shaik mastan sir @srestha mam @arvin .....anyone please explain this problem
no need  to add our names, we will responds automatically if we see the question.

Moreover no need to call me as sir.

1 Answer

0 votes

This is an extended question from this

while(number[j]!=0 and (number[j],i) < (number[i], i))

This line specifies that, if two process has same value, Suppose P2=2 and P3=2, then among i and j , which one will has less value will execute first. Here P2 index value is less So, it will execute first. So, it will be guaranteed Mutual Exclusion. Also it will execute FCFS manner. But there should not be any Starvation.

So, ans B)



by Veteran

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,215 questions
60,006 answers
94,685 users