Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
335 views
in Computer by (114k points)
closed by
At a particular time of computation, the value of a counting semaphore is 7. Then 20 P operation and x V operations were completed on this semaphore. If the final value of the semaphore is 5, x will be
1. 18
2. 22
3. 15
4. 13

1 Answer

0 votes
by (115k points)
selected by
 
Best answer
Correct Answer - Option 1 : 18

Concepts:

V(S): signal operation will increment the semaphore variable, that is, S++. 

P(S): wait operation will decrement the semaphore variable., that is, S--. 

Data:

Initial counting semaphore (I) = 7

Signal operation = x V

Wait operation = 20 P

Final counting semaphore (F) = 5

Calculation:

5 = 7 + x V + 20 P

5 = 7 + x (+1) + 20 (-1)

x = 5 - 7 + 20

∴ x = 18

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...