1,013 views
0 votes
0 votes
Assume Counting Semaphore N=8.

On performing 10 down() operations by 10 different processes , first 8 will be successful and last two processes will be suspended.

Does this mean that the first 8 processes can enter in the CS at the same time?

In other words, does counting semaphore can let multiple processes access the CS at the same time?

1 Answer

Best answer
2 votes
2 votes

Semaphores are used to coordinate the shared resource access. We can implement semaphores in two different ways. In simple terms, they represent how many resources are available for us to use at a given time. 

  1. Binary semaphore:
    • This is used when we want to implement Mutual Exclusion. 
    • Only one instance of the resource is available thus only one process can enter into the CS at a given time.
    • The values are 0 or 1 for the binary semaphore.
  2. Counting Semaphore:
    • This is used when we have multiple instances of a resource available.
    • The value of counting semaphore is set to the total available resource instances. 
    • Thus allowing multiple processes to use the resource if it's available. 

So if the initial value of counting semaphore is 8 and if we perform 10 down() operations, 

  • First 8 process can access the resource.
  • The remaining 2 process gets blocked. 

 

selected by

Related questions

3 votes
3 votes
3 answers
1
GateAspirant999 asked Feb 14, 2017
2,440 views
Below are four concurrent processes and three counting semaphores.What must be the initial values of the three semaphores, so that output “TGE” is obtained?
1 votes
1 votes
2 answers
2
dirac asked Nov 13, 2015
1,528 views
A binary semaphore ensures mutual exclusion. Does a counting semaphore ensure mutual exclusion too?Please justify your answers.
1 votes
1 votes
1 answer
3
Rahul_Rathod_ asked Dec 12, 2018
1,507 views
a) s1-wait(p) , s2-wait(q) , s3-wait(q) , s4-wait(p)b) s1-wait(p) , s2-wait(q) , s3-wait(p) , s4-wait(q)c) s1-wait(q) , s2-wait(p) , s3-wait(p) , s4-wait(q)d) none of...
0 votes
0 votes
0 answers
4