Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider a counting Semaphore variable S. Fol... Start Learning for Free
Consider a counting Semaphore variable 'S'. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?
  • a)
    3
  • b)
    4
  • c)
    5
  • d)
    None of the these
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
Consider a counting Semaphore variable S. Following are the semaphore ...
To determine the largest initial value of S that keeps one process in the suspended list, let's analyze the given semaphore operations step by step.

Given semaphore operations:
- 18P: This operation tries to decrement the semaphore value by 18. If the semaphore value is already less than 18, the process will be suspended. Otherwise, it will continue. Let's assume the initial value of S is x, then after this operation, the new value of S will be (x - 18).

- 3V: This operation increments the semaphore value by 3. After this operation, the new value of S will be (x - 18 + 3) = (x - 15).

- 7V: This operation increments the semaphore value by 7. After this operation, the new value of S will be (x - 15 + 7) = (x - 8).

- 2P: This operation tries to decrement the semaphore value by 2. If the semaphore value is already less than 2, the process will be suspended. Otherwise, it will continue. After this operation, the new value of S will be (x - 8 - 2) = (x - 10).

- 6V: This operation increments the semaphore value by 6. After this operation, the new value of S will be (x - 10 + 6) = (x - 4).

Now, we need to find the largest initial value of S such that it keeps one process in the suspended list. This means that after all the operations, the semaphore value should be less than 0 to suspend a process.

So, we need to find the value of x that satisfies the following inequality: (x - 4) < />

Solving this inequality, we get x < />

Therefore, the largest initial value of S that keeps one process in the suspended list is 3.

Hence, the correct answer is option A.
Free Test
Community Answer
Consider a counting Semaphore variable S. Following are the semaphore ...
Semaphore: it is an integer variable which is used by different processes in a mutually exclusive manner so as to achieve synchronisation.
There are two types of Semaphores:
  • Counting Semaphores: The integer values in this type of semaphore can range over more than 0s and 1s
  • Binary Semaphores: The integer values in this type of semaphore can only be binary in nature, that is, 0s and 1s.
There are two types of operations that are atomic and mutually exclusive in nature:
  • Wait (S) or P: If the semaphore value is greater than 0, decrement it. If it is less than 0, then wait for the semaphore to become greater than 0 and then decrement it.
  • Signal (S) or V: Increment the value of the semaphore. If the semaphore is of binary type, and is already 1, then again replace the value by 1.
Calculations:
  • Let the initial value of counting semaphore be 'x'.
  • One process is in suspend list, which makes the final value to be -1.
  • −1=x−18+3+7−2+6
  • −1=x−20+16
  • x=20−16−1
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 variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect answer is option 'A'. Can you explain this answer?
Question Description
Consider a counting Semaphore variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect 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 variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect 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 variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect answer is option 'A'. Can you explain this answer?.
Solutions for Consider a counting Semaphore variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect 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 variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect 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 variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for Consider a counting Semaphore variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of Consider a counting Semaphore variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider a counting Semaphore variable S. Following are the semaphore operations performed: 18P, 3V, 7V, 2P, 6V. What can be the largest initial value of S to keep one process in suspended list?a)3b)4c)5d)None of the theseCorrect 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