Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a counting semaphore S. The operatio... Start Learning for Free
Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.
  • a)
    7
  • b)
    8
  • c)
    9
  • d)
    6
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
Consider a counting semaphore S. The operation P(S) performs the opera...
- 1, while the operation V(S) performs the operation S = S + 1.

The counting semaphore S can have any non-negative integer value. Initially, it is set to a positive value to allow a certain number of concurrent processes to access a shared resource. When a process wants to access the resource, it needs to perform the operation P(S) to decrease the value of S. If the value becomes negative after the decrement, the process is blocked until another process performs the operation V(S) to increase the value of S.

For example, if the initial value of S is 3, three processes can access the resource concurrently. When the first process wants to access the resource, it performs P(S) and the value of S becomes 2. If the second process also performs P(S) before the first process performs V(S), the value of S becomes 1. Finally, when the third process performs P(S), the value of S becomes 0 and any subsequent processes that try to perform P(S) will be blocked until one of the processes performs V(S) to increase the value of S.

The counting semaphore is a useful synchronization primitive that allows a limited number of processes to access a shared resource concurrently while blocking any additional processes until the resource becomes available.
Free Test
Community Answer
Consider a counting semaphore S. The operation P(S) performs the opera...
Given,
V(S): Signal will increment the semaphore variable, that is, S + +.
P(S): Signal will decrement the semaphore variable., that is, S − −.
Initial counting semaphore = x = 1
Signal operation =11 V
Wait operation =17 P
n process in blocked state.
Final counting semaphore (F) = −n
We know that:
n = x + 13P + 5V
Now,
n = 1 + 13( − 1) + 5(+1)
∴ n = −7
∴ Number of process in blocked state is 7.
Hence, the correct option is (A).
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer?
Question Description
Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer?.
Solutions for Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer?, a detailed solution for Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a counting semaphore S. The operation P(S) performs the operation S = S − 1 and operation V(S) performs the operation V = V + 1. During program execution, 13 P and 5 V operation is performed in the some order. Find the number of processes in a blocked state with initial counting semaphore value 1.a)7b)8c)9d)6Correct answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev