edited by
624 views
2 votes
2 votes

Suppose that an operating system provides two functions, block() which puts the calling process on the blocked queue, and wakeup(P) which moves process P to the ready queue if it is currently on the blocked queue. wakeup(P) does not perform any action if the process P is NOT in the blocked queue.

Consider two processes A and B running the code given below.


Which of the following is TRUE regarding the behaviour of the system when we run A and B concurrently on the uni-processor system?

  1. It is possible to have deadlock in the system.
  2. A and B will always run forever with strick alternation printing ABABAB….
  3. A and B will always run forever with strick alternation printing BABABA….
  4. None of these
edited by

1 Answer

2 votes
2 votes

IT IS POSSIBLE TO HAVE DEADLOCK WHEN B STARTS FIRST AND PRINTS "B" AND THEN WAKEUP A AND BLOCKS ITSELF , THEN WHENEVER A STARTS IT PROCESS FROM NOW IT WILL FIRST BLOCK ITSELF.

AS BOTH PROCESSES ARE IN BLOCKED STATE AND BOTH LOOKING FOR EACHOTHER TO WAKEUP IT LEADS TO A DEAD STATE 

OPTION C ALSO POSSIBLE BUT IT IS CORRECT IF THE WORD "ALWAYS " IS NOT THERE. 

CORRECT ANSWER: "A"

Answer:

Related questions

722
views
2 answers
9 votes
GO Classes asked Feb 5
722 views
Assume a linear page table, with a 1-byte page-table entry. Assume physical and virtual address spaces of size 128 bytes with 32-byte pages. The ... addresses that will get referred in fetch and execute of the above instruction?104210270