0
1.1kviews
With help of neat diagram describe binary semaphore.
1 Answer
0
6views
  • A binary semaphore can only take two values 0 or 1.
  • Semaphore value 0 or 1 is used to indicate availability and unavailability respectively.
  • Consider task 1 and task 2 wanting to access a resource (say printer).
  • Semaphore is like a key when acquired count is 0. Task A acquires the shared resource and changes semaphore count to 0 to indicate shared resource is not available for anothertask.
  • At the same time, task B wants to acquire the shared resource but has to wait till the count becomes 1.
  • Now task B can acquire the shared resource

enter image description here

Please log in to add an answer.