Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a non-negative counting semaphore S.... Start Learning for Free
Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked is 
  • a)
    7
  • b)
    8
  • c)
    9
  • d)
    10
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Consider a non-negative counting semaphore S. The operation P(S) decre...
20-7 -> 13 will be in blocked state, when we perform 12 V(S) operation makes 12 more process to get chance for execution from blocked state. So one process will be left in the queue (blocked state) here i have considered that if a process is in under CS then it not get blocked by other process.
This question is part of UPSC exam. View all Computer Science Engineering (CSE) courses
Most Upvoted Answer
Consider a non-negative counting semaphore S. The operation P(S) decre...
To determine the largest initial value of semaphore S for which at least one P(S) operation will remain blocked, we need to consider the number of P(S) and V(S) operations issued and their order of execution. Let's analyze the given information step by step:

Given:
- Number of P(S) operations issued = 20
- Number of V(S) operations issued = 12

To find the largest initial value of S, let's assume S = X and analyze the possible scenarios.

1. X = 0:
- In this case, all 20 P(S) operations will be blocked as the semaphore value is initially 0.
- Since no V(S) operation is executed yet, there is no chance for any P(S) operation to be unblocked.
- Therefore, the largest initial value of S for which at least one P(S) operation will remain blocked is not possible when X = 0.

2. X = 1:
- In this case, the first P(S) operation will block as the semaphore value becomes 0.
- After that, all subsequent P(S) operations will also block as the semaphore value remains 0.
- Since no V(S) operation is executed yet, there is no chance for any P(S) operation to be unblocked.
- Therefore, the largest initial value of S for which at least one P(S) operation will remain blocked is not possible when X = 1.

3. X = 2:
- The first P(S) operation will decrement S from 2 to 1, so it will not block.
- The second P(S) operation will decrement S from 1 to 0, so it will block.
- Since no V(S) operation is executed yet, there is no chance for the second P(S) operation to be unblocked.
- Therefore, the largest initial value of S for which at least one P(S) operation will remain blocked is not possible when X = 2.

4. X = 3:
- The first P(S) operation will decrement S from 3 to 2, so it will not block.
- The second P(S) operation will decrement S from 2 to 1, so it will not block.
- The third P(S) operation will decrement S from 1 to 0, so it will block.
- Since no V(S) operation is executed yet, there is no chance for the third P(S) operation to be unblocked.
- Therefore, the largest initial value of S for which at least one P(S) operation will remain blocked is not possible when X = 3.

5. X = 4:
- The first P(S) operation will decrement S from 4 to 3, so it will not block.
- The second P(S) operation will decrement S from 3 to 2, so it will not block.
- The third P(S) operation will decrement S from 2 to 1, so it will not block.
- The fourth P(S) operation will decrement S from 1 to 0, so it will block.
- Since no V(S) operation is executed yet, there is no chance for the fourth P(S) operation to be unblocked.
- Therefore, the largest initial value of S for which at least one P(S) operation will remain blocked is not possible when X = 4.

6. X = 5:
- The first P
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer?
Question Description
Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct 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 non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct 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 non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer?.
Solutions for Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct 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 non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer?, a detailed solution for Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer? has been provided alongside types of Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a non-negative counting semaphore S. The operation P(S) decrements S, and V(S) increments S. During an execution, 20 P(S) operations and 12 V(S) operations are issued in some order. The largest initial value of S for which at least one P(S) operation will remain blocked isa)7b)8c)9d)10Correct 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