closed by
2,888 views
0 0 votes
closed as a duplicate of: GATE CSE 2023 | Question: 28


incr()
{
    wait(s)
    x = x+1
    signal(s)
 }
 decr()
 {
    wait(s)
    x = x–1
    signal(s)
 }

Shared integer variable $\mathrm{x}$ initialized with $10.$
There are five threads which are calling incr() and there are three threads which are calling decr().
For binary semaphore $\mathrm{s}=1$ minimum possible value of $\mathrm{x}$ is $\mathrm{V}_1$
For counting semaphore $s=2$ minimum possible value of $\mathrm{x}$ is $\mathrm{V}_2$
  1. $15,8$
  2. $12,8$
  3. $15,7$
  4. $12,7$

1 Answer

0 0 votes
here one option is  ( 7,7)

explaination  run 2 times decrement  completly  so it become 8 and  upto write operation last  one so it will become 7 but 7 is not update it stored in reg.  now rul completly 5 increment whatever we got  it will update it to 7, so minimum value will me 7.

am i correct

@goclasses

@deepakpoonia
Answer:
Position:
Show:

Related questions

1 1 vote
0 0 answers
2.0k
2.0k views
GO Classes asked Feb 5, 2023
1,969 views
In general which of the following CPU scheduling algorithms suffers from starvation?SJFFCFSRound robinPriority
1 1 vote
1 1 answer
1.9k
1.9k views
GO Classes asked Feb 5, 2023
1,903 views
Which of the following option guarantee that a computer system transit from user mode to kernel modemalloc callsystem callfunction callpage fault