Time Left - 15:00 mins

GATE CS 2021 : Operating System Quiz 6 (App update required to attempt this test)

Attempt now to get your rank among 496 students!

Question 1

What will be the output of the following code?
Int main()
{
int i=1;
fork();
i++;
printf(“%d”,i);
fork();
i++;
printf(“%d”,i);
fork();
i++;
printf(“%d”,i);
}

Question 2

Consider the following 3 processes with 3 binary semaphores with initial values

What will be the correct pattern generated by these 3 processes, write it without any space between the digit?

Question 3

Suppose counting semaphore s having value If 19P, 12V and 3P operation perform respectively on s. then after performing these operation value of s will be ____. Assuming the initial value of s be 15.

Question 4

Consider two concurrent processes Computer() and Science() which uses 3 semaphores mutex, A and B which are initialized to 1 Suppose A s the semaphore to file 1 and B is the semaphore to file 2

Computer()

{

P(mutex);

P(A);

// write on file 1;

P(B);

// write on file 2;

V(A);

V(mutex); // do something;

P(A);

// read from file 1;

// write to file 2;

V(B);

V(A);

}

Science()

{

P(A);

// read on file 1;

P(B);

// write on file 2;

V(A);

V(B);

P(mutex); // do something;

P(A);

// write to file 1;

V(A);

V(mutex);

}

Which of the following Statement is true?

Question 5

Race conditions in critical sections can be avoided if

Question 6

Which of the following conditions does not hold good for a solution to a critical section problem?
  • 496 attempts
  • 3 upvotes
  • 4 comments
Sep 1GATE & PSU CS