239 views
2 2 votes

Consider three concurrent processes $P_1, P_2$, and $P_3$ sharing a single counting semaphore $\verb|S|$ initialized to $\mathbf{2}$. Each process executes the following sequence of operations exactly once:

wait(S);
// Critical Section
signal(S);
signal(S);

Which of the following statements is/are TRUE after all three processes have finished execution?

  1. THE MAXIMUM POSSIBLE VALUE OF THE SEMAPHORE $\verb|S|$ IS $5$.
     
  2. THE MINIMUM POSSIBLE VALUE OF THE SEMAPHORE $\verb|S|$ IS $2$.
     
  3. DEADLOCK IS NOT POSSIBLE IN THIS SCENARIO.
     
  4. AT MOST TWO PROCESSES CAN BE IN THE CRITICAL SECTION SIMULTANEOUSLY AT ANY POINT.

1 Answer

0 0 votes

(A) is TRUE: Total signals $(6)$ minus total waits $(3)$ added to initial $(2)$ equals $5$.

(C) is TRUE: Since $S$ starts at $2$, at least two processes can always proceed; no circular wait can occur.

(D) is TRUE: The initial $\verb|wait(S)|$ prevents more than two processes from entering the CS before a $\verb|signal(S)|$ occurs.

Answer:
Position:
Show:

Related questions

3 3 votes
2 2 answers
328
328 views
GO Classes asked Feb 16
328 views
A system has $4$ copies of resource $R$. There are $n$ processes, and each process requires at most $2$ copies of resource $R$ to complete its execution.Which of the foll...
4 4 votes
1 1 answer
246
246 views
GO Classes asked Feb 16
246 views
An inode-based file system uses $4$ KB blocks and $4$-byte disk addresses. The inode contains $12$ direct block pointers, $1$ single indirect pointer, and $1$ double indi...
2 2 votes
2 2 answers
253
253 views
GO Classes asked Feb 16
253 views
Consider three processes with the following CPU burst times: $P_1=2, P_2=7$, and $P_3=10$. All processes arrive at time $t=0$. The system uses Round Robin scheduling with...
4 4 votes
2 2 answers
282
282 views
GO Classes asked Feb 16
282 views
A computer system uses $\mathbf{32}$-bit virtual addresses. The system implements a two-level hierarchical paging scheme. The page size of the Outer Page Table is exactly...