Initial value of semaphore is
$7$
Each $P$ wait operation decreases the semaphore value by $1$.
So, after $20$ $P$ operations:
$7-20=-13$
Each $V$ signal operation increases the semaphore value by $1$.
So, after $15$ $V$ operations:
$-13+15=2$
Therefore, resulting value of semaphore is
$2$
Online Test Series, Information About Examination,
Syllabus, Notification
and More.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.