The Gateway to Computer Science Excellence
+1 vote

How to solve it ?

in Operating System by Junior (875 points) | 67 views

P2 will never run 

after running 3 times it will print "CCC" and deadlock.

goto statement in C programming provides an unconditional jump from the 'goto' to a labeled statement in the same function.

NOTE − Use of goto statement is highly discouraged in any programming language because it makes difficult to trace the control flow of a program, making the program hard to understand and hard to modify. Any program that uses a goto can be rewritten to avoid them.

No one is signaling L. Okay that causes deadlock.

But what if L1 gets preempted after Signal(R)? A will be printed, right?
Oh yeah, in that case it will print "AB" and keeps on printing until R exhausts or P2 is preempted.

thanks for pointing out
How is 0 answer but .
they are asking smallest number of A's that might be printed.

they mean there exist that scenario where no "A" is printed. If there is no preemption then there will be no A's.
okk got it :o

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,291 answers
104,902 users