1,717 views

2 Answers

2 2 votes

The maximum value of $count = 45$ & the minimum value of the $count = 6$. So C. $45, 6$ is the corect answer.

In the CPU, count = count + 3 will be perform the below operations -

LOAD count // AC <- count
INCREMENT 3 // AC <- AC + 3
STORE count // count <- AC

Note that, count & n is global variable in the given code.

To find the maximum value of count, we have to run GATE-1(), GATE-2() & GATE-3() in sequential manner. And we get the maximum value of $count = 45$.

To find the minimum value of count, we have follow the below steps -

So, the minimum value of count is $6$.

0 0 votes
I am able to get the point that how it is 45 because suppose a process came and it does not got preempt so he will execute all gate() function and now all the one execution of gate() leads to value 15 therefore 3 execution will lead to 45.

Now coming for min value i am just not able to get according to me it should be zero.
Position:
Show:

Related questions

0 0 votes
1 1 answer
713
713 views
Magma asked Aug 20, 2018
713 views
I think...answer should be p1,p2 ..if you think that given answer is correct then please explain me , thank you ;)
0 0 votes
1 1 answer
793
793 views
Magma asked Aug 16, 2018
793 views
0 0 votes
1 1 answer
935
935 views
Magma asked Aug 15, 2018
935 views