closed by
1,545 views
0 votes
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$
closed by

1 Answer

0 votes
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:

Related questions

1 votes
1 votes
0 answers
1
1 votes
1 votes
1 answer
2
GO Classes asked Feb 5, 2023
1,174 views
Which of the following option guarantee that a computer system transit from user mode to kernel modemalloc callsystem callfunction callpage fault